summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-11-10 15:09:09 (UTC)
committer harlekin <harlekin>2002-11-10 15:09:09 (UTC)
commit91932ca42cee5568477b1e49532a0b9e4d9bcf96 (patch) (unidiff)
treef134612cf7aa15787077b0a76c34aab30d72cae3
parentb6b57412a12c06d07f22060b7a165d71e5eddb84 (diff)
downloadopie-91932ca42cee5568477b1e49532a0b9e4d9bcf96.zip
opie-91932ca42cee5568477b1e49532a0b9e4d9bcf96.tar.gz
opie-91932ca42cee5568477b1e49532a0b9e4d9bcf96.tar.bz2
besser seekable handling
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp33
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h1
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp16
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h4
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp7
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp7
8 files changed, 46 insertions, 26 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index a6fd334..00d516c 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -144,112 +144,110 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
144 QString skinPath = "opieplayer2/skins/" + skin; 144 QString skinPath = "opieplayer2/skins/" + skin;
145 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 145 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
146 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 146 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
147 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 147 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
148 148
149 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); 149 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
150 imgButtonMask->fill( 0 ); 150 imgButtonMask->fill( 0 );
151 151
152 for ( int i = 0; i < 10; i++ ) { 152 for ( int i = 0; i < 10; i++ ) {
153 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); 153 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" );
154 masks[i] = new QBitmap( filename ); 154 masks[i] = new QBitmap( filename );
155 155
156 if ( !masks[i]->isNull() ) { 156 if ( !masks[i]->isNull() ) {
157 QImage imgMask = masks[i]->convertToImage(); 157 QImage imgMask = masks[i]->convertToImage();
158 uchar **dest = imgButtonMask->jumpTable(); 158 uchar **dest = imgButtonMask->jumpTable();
159 for ( int y = 0; y < imgUp->height(); y++ ) { 159 for ( int y = 0; y < imgUp->height(); y++ ) {
160 uchar *line = dest[y]; 160 uchar *line = dest[y];
161 for ( int x = 0; x < imgUp->width(); x++ ) 161 for ( int x = 0; x < imgUp->width(); x++ )
162 if ( !qRed( imgMask.pixel( x, y ) ) ) 162 if ( !qRed( imgMask.pixel( x, y ) ) )
163 line[x] = i + 1; 163 line[x] = i + 1;
164 } 164 }
165 } 165 }
166 166
167 } 167 }
168 168
169 for ( int i = 0; i < 10; i++ ) { 169 for ( int i = 0; i < 10; i++ ) {
170 buttonPixUp[i] = 0l; 170 buttonPixUp[i] = 0l;
171 buttonPixDown[i] = 0l; 171 buttonPixDown[i] = 0l;
172 } 172 }
173 173
174 setBackgroundPixmap( *pixBg ); 174 setBackgroundPixmap( *pixBg );
175 175
176 songInfo.setFocusPolicy( QWidget::NoFocus ); 176 songInfo.setFocusPolicy( QWidget::NoFocus );
177 changeTextColor( &songInfo ); 177 changeTextColor( &songInfo );
178 178
179 slider.setFixedHeight( 20 ); 179 slider.setFixedHeight( 20 );
180 slider.setMinValue( 0 ); 180 slider.setMinValue( 0 );
181 slider.setMaxValue( 1 ); 181 slider.setMaxValue( 1 );
182 slider.setFocusPolicy( QWidget::NoFocus ); 182 slider.setFocusPolicy( QWidget::NoFocus );
183 slider.setBackgroundPixmap( *pixBg ); 183 slider.setBackgroundPixmap( *pixBg );
184 184
185 time.setFocusPolicy( QWidget::NoFocus ); 185 time.setFocusPolicy( QWidget::NoFocus );
186 time.setAlignment( Qt::AlignCenter ); 186 time.setAlignment( Qt::AlignCenter );
187 time.setFrame(FALSE); 187 time.setFrame(FALSE);
188 changeTextColor( &time ); 188 changeTextColor( &time );
189 189
190 resizeEvent( NULL ); 190 resizeEvent( NULL );
191 191
192 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 192 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
193 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 193 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
194 194
195 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 195 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
196 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 196 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
197 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 197 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
198 // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
199 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 198 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
199 connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) );
200 200
201 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); 201 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) );
202 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); 202 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) );
203 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); 203 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) );
204 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); 204 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) );
205 205
206
207
208 // Intialise state 206 // Intialise state
209 setLength( mediaPlayerState->length() ); 207 setLength( mediaPlayerState->length() );
210 setPosition( mediaPlayerState->position() ); 208 setPosition( mediaPlayerState->position() );
211 setLooping( mediaPlayerState->fullscreen() ); 209 setLooping( mediaPlayerState->fullscreen() );
212 // setPaused( mediaPlayerState->paused() ); 210 // setPaused( mediaPlayerState->paused() );
213 setPlaying( mediaPlayerState->playing() ); 211 setPlaying( mediaPlayerState->playing() );
214 212
215} 213}
216 214
217AudioWidget::~AudioWidget() { 215AudioWidget::~AudioWidget() {
218 216
219 for ( int i = 0; i < 10; i++ ) { 217 for ( int i = 0; i < 10; i++ ) {
220 delete buttonPixUp[i]; 218 delete buttonPixUp[i];
221 delete buttonPixDown[i]; 219 delete buttonPixDown[i];
222 } 220 }
223 delete pixBg; 221 delete pixBg;
224 delete imgUp; 222 delete imgUp;
225 delete imgDn; 223 delete imgDn;
226 delete imgButtonMask; 224 delete imgButtonMask;
227 for ( int i = 0; i < 10; i++ ) { 225 for ( int i = 0; i < 10; i++ ) {
228 delete masks[i]; 226 delete masks[i];
229 } 227 }
230// mediaPlayerState->setPlaying(false); 228// mediaPlayerState->setPlaying(false);
231} 229}
232 230
233namespace { 231namespace {
234 232
235QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 233QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
236 QPixmap pix( img.width(), img.height() ); 234 QPixmap pix( img.width(), img.height() );
237 QPainter p( &pix ); 235 QPainter p( &pix );
238 p.drawTiledPixmap( pix.rect(), bg, offset ); 236 p.drawTiledPixmap( pix.rect(), bg, offset );
239 p.drawImage( 0, 0, img ); 237 p.drawImage( 0, 0, img );
240 return new QPixmap( pix ); 238 return new QPixmap( pix );
241} 239}
242 240
243 241
244QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) { 242QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) {
245 QPixmap *pixmap = new QPixmap( pix ); 243 QPixmap *pixmap = new QPixmap( pix );
246 pixmap->setMask( mask ); 244 pixmap->setMask( mask );
247 return pixmap; 245 return pixmap;
248} 246}
249 247
250}; 248};
251 249
252void AudioWidget::resizeEvent( QResizeEvent * ) { 250void AudioWidget::resizeEvent( QResizeEvent * ) {
253 int h = height(); 251 int h = height();
254 int w = width(); 252 int w = width();
255 253
@@ -263,121 +261,124 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
263 yoff = (( h - imgUp->height() ) / 2) - 10; 261 yoff = (( h - imgUp->height() ) / 2) - 10;
264 QPoint p( xoff, yoff ); 262 QPoint p( xoff, yoff );
265 263
266 QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p ); 264 QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p );
267 QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p ); 265 QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p );
268 266
269 for ( int i = 0; i < 10; i++ ) { 267 for ( int i = 0; i < 10; i++ ) {
270 if ( !masks[i]->isNull() ) { 268 if ( !masks[i]->isNull() ) {
271 delete buttonPixUp[i]; 269 delete buttonPixUp[i];
272 delete buttonPixDown[i]; 270 delete buttonPixDown[i];
273 buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] ); 271 buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] );
274 buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] ); 272 buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] );
275 } 273 }
276 } 274 }
277 275
278 delete pixUp; 276 delete pixUp;
279 delete pixDn; 277 delete pixDn;
280} 278}
281 279
282static bool audioSliderBeingMoved = FALSE; 280static bool audioSliderBeingMoved = FALSE;
283 281
284 282
285void AudioWidget::sliderPressed() { 283void AudioWidget::sliderPressed() {
286 audioSliderBeingMoved = TRUE; 284 audioSliderBeingMoved = TRUE;
287} 285}
288 286
289 287
290void AudioWidget::sliderReleased() { 288void AudioWidget::sliderReleased() {
291 audioSliderBeingMoved = FALSE; 289 audioSliderBeingMoved = FALSE;
292 if ( slider.width() == 0 ) 290 if ( slider.width() == 0 )
293 return; 291 return;
294 long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); 292 long val = long((double)slider.value() * mediaPlayerState->length() / slider.width());
295 mediaPlayerState->setPosition( val ); 293 mediaPlayerState->setPosition( val );
296} 294}
297 295
298void AudioWidget::setPosition( long i ) { 296void AudioWidget::setPosition( long i ) {
299 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 297 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
300 updateSlider( i, mediaPlayerState->length() ); 298 updateSlider( i, mediaPlayerState->length() );
301} 299}
302 300
303 301
304void AudioWidget::setLength( long max ) { 302void AudioWidget::setLength( long max ) {
305 updateSlider( mediaPlayerState->position(), max ); 303 updateSlider( mediaPlayerState->position(), max );
306} 304}
307 305
308 306
309void AudioWidget::setView( char view ) { 307void AudioWidget::setView( char view ) {
310 308
311 // this isnt working for some reason 309if ( view == 'a' ) {
310 // startTimer( 150 );
311 showMaximized();
312 } else {
313 killTimers();
314 hide();
315 }
316 // qApp->processEvents();
317}
318
319
320void AudioWidget::setSeekable( bool isSeekable ) {
312 321
313 if ( mediaPlayerState->streaming() ) { 322 if ( isSeekable ) {
314 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); 323 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
315 if( !slider.isHidden()) { 324 if( !slider.isHidden()) {
316 slider.hide(); 325 slider.hide();
317 } 326 }
318 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 327 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
319 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 328 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
320 } else { 329 } else {
321 // this stops the slider from being moved, thus 330 // this stops the slider from being moved, thus
322 // does not stop stream when it reaches the end 331 // does not stop stream when it reaches the end
323 slider.show(); 332 slider.show();
333 qDebug( " CONNECT SET POSTION " );
324 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 334 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
325 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 335 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
326 } 336 }
327
328 if ( view == 'a' ) {
329 // startTimer( 150 );
330 showMaximized();
331 } else {
332 killTimers();
333 hide();
334 }
335 // qApp->processEvents();
336} 337}
337 338
338 339
339static QString timeAsString( long length ) { 340static QString timeAsString( long length ) {
340 int minutes = length / 60; 341 int minutes = length / 60;
341 int seconds = length % 60; 342 int seconds = length % 60;
342 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); 343 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 );
343} 344}
344 345
345void AudioWidget::updateSlider( long i, long max ) { 346void AudioWidget::updateSlider( long i, long max ) {
346 347
347 time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); 348 time.setText( timeAsString( i ) + " / " + timeAsString( max ) );
348// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; 349// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ;
349 350
350 if ( max == 0 ) { 351 if ( max == 0 ) {
351 return; 352 return;
352 } 353 }
353 // Will flicker too much if we don't do this 354 // Will flicker too much if we don't do this
354 // Scale to something reasonable 355 // Scale to something reasonable
355 int width = slider.width(); 356 int width = slider.width();
356 int val = int((double)i * width / max); 357 int val = int((double)i * width / max);
357 if ( !audioSliderBeingMoved ) { 358 if ( !audioSliderBeingMoved ) {
358 if ( slider.value() != val ) { 359 if ( slider.value() != val ) {
359 slider.setValue( val ); 360 slider.setValue( val );
360 } 361 }
361 362
362 if ( slider.maxValue() != width ) { 363 if ( slider.maxValue() != width ) {
363 slider.setMaxValue( width ); 364 slider.setMaxValue( width );
364 } 365 }
365 } 366 }
366} 367}
367 368
368 369
369void AudioWidget::setToggleButton( int i, bool down ) { 370void AudioWidget::setToggleButton( int i, bool down ) {
370 qDebug("setToggleButton %d", i); 371 qDebug("setToggleButton %d", i);
371 if ( down != audioButtons[i].isDown ) { 372 if ( down != audioButtons[i].isDown ) {
372 toggleButton( i ); 373 toggleButton( i );
373 } 374 }
374} 375}
375 376
376 377
377void AudioWidget::toggleButton( int i ) { 378void AudioWidget::toggleButton( int i ) {
378 audioButtons[i].isDown = !audioButtons[i].isDown; 379 audioButtons[i].isDown = !audioButtons[i].isDown;
379 QPainter p(this); 380 QPainter p(this);
380 paintButton ( &p, i ); 381 paintButton ( &p, i );
381} 382}
382 383
383 384
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index c544882..09dc19b 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -49,96 +49,97 @@ class QPixmap;
49namespace { 49namespace {
50 50
51enum AudioButtons { 51enum AudioButtons {
52 AudioPlay=0, 52 AudioPlay=0,
53 AudioStop, 53 AudioStop,
54 AudioNext, 54 AudioNext,
55 AudioPrevious, 55 AudioPrevious,
56 AudioVolumeUp, 56 AudioVolumeUp,
57 AudioVolumeDown, 57 AudioVolumeDown,
58 AudioLoop, 58 AudioLoop,
59 AudioPlayList, 59 AudioPlayList,
60 AudioForward, 60 AudioForward,
61 AudioBack 61 AudioBack
62}; 62};
63}; 63};
64 64
65class Ticker : public QFrame { 65class Ticker : public QFrame {
66 Q_OBJECT 66 Q_OBJECT
67 67
68public: 68public:
69 Ticker( QWidget* parent=0 ); 69 Ticker( QWidget* parent=0 );
70 ~Ticker(); 70 ~Ticker();
71 void setText( const QString& text ) ; 71 void setText( const QString& text ) ;
72 72
73protected: 73protected:
74 void timerEvent( QTimerEvent * ); 74 void timerEvent( QTimerEvent * );
75 void drawContents( QPainter *p ); 75 void drawContents( QPainter *p );
76private: 76private:
77 QString scrollText; 77 QString scrollText;
78 int pos, pixelLen; 78 int pos, pixelLen;
79}; 79};
80 80
81 81
82class AudioWidget : public QWidget { 82class AudioWidget : public QWidget {
83 Q_OBJECT 83 Q_OBJECT
84public: 84public:
85 AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); 85 AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 );
86 ~AudioWidget(); 86 ~AudioWidget();
87 void setTickerText( const QString &text ) { songInfo.setText( text ); } 87 void setTickerText( const QString &text ) { songInfo.setText( text ); }
88public slots: 88public slots:
89 void updateSlider( long, long ); 89 void updateSlider( long, long );
90 void sliderPressed( ); 90 void sliderPressed( );
91 void sliderReleased( ); 91 void sliderReleased( );
92// void setPaused( bool b) { setToggleButton( AudioPause, b ); } 92// void setPaused( bool b) { setToggleButton( AudioPause, b ); }
93 void setLooping( bool b) { setToggleButton( AudioLoop, b ); } 93 void setLooping( bool b) { setToggleButton( AudioLoop, b ); }
94 void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } 94 void setPlaying( bool b) { setToggleButton( AudioPlay, b ); }
95 void setPosition( long ); 95 void setPosition( long );
96 void setLength( long ); 96 void setLength( long );
97 void setSeekable( bool );
97 void setView( char ); 98 void setView( char );
98 99
99signals: 100signals:
100 void moreClicked(); 101 void moreClicked();
101 void lessClicked(); 102 void lessClicked();
102 void moreReleased(); 103 void moreReleased();
103 void lessReleased(); 104 void lessReleased();
104 void forwardClicked(); 105 void forwardClicked();
105 void backClicked(); 106 void backClicked();
106 void forwardReleased(); 107 void forwardReleased();
107 void backReleased(); 108 void backReleased();
108 void sliderMoved(long); 109 void sliderMoved(long);
109 110
110protected: 111protected:
111 void doBlank(); 112 void doBlank();
112 void doUnblank(); 113 void doUnblank();
113 void paintEvent( QPaintEvent *pe ); 114 void paintEvent( QPaintEvent *pe );
114 void showEvent( QShowEvent *se ); 115 void showEvent( QShowEvent *se );
115 void resizeEvent( QResizeEvent *re ); 116 void resizeEvent( QResizeEvent *re );
116 void mouseMoveEvent( QMouseEvent *event ); 117 void mouseMoveEvent( QMouseEvent *event );
117 void mousePressEvent( QMouseEvent *event ); 118 void mousePressEvent( QMouseEvent *event );
118 void mouseReleaseEvent( QMouseEvent *event ); 119 void mouseReleaseEvent( QMouseEvent *event );
119 void timerEvent( QTimerEvent *event ); 120 void timerEvent( QTimerEvent *event );
120 void closeEvent( QCloseEvent *event ); 121 void closeEvent( QCloseEvent *event );
121 void keyReleaseEvent( QKeyEvent *e); 122 void keyReleaseEvent( QKeyEvent *e);
122private slots: 123private slots:
123 void skipFor(); 124 void skipFor();
124 void skipBack(); 125 void skipBack();
125 void stopSkip(); 126 void stopSkip();
126private: 127private:
127 void toggleButton( int ); 128 void toggleButton( int );
128 void setToggleButton( int, bool ); 129 void setToggleButton( int, bool );
129 void paintButton( QPainter *p, int i ); 130 void paintButton( QPainter *p, int i );
130 int skipDirection; 131 int skipDirection;
131 QString skin; 132 QString skin;
132 QPixmap *pixBg; 133 QPixmap *pixBg;
133 QImage *imgUp; 134 QImage *imgUp;
134 QImage *imgDn; 135 QImage *imgDn;
135 QImage *imgButtonMask; 136 QImage *imgButtonMask;
136 QBitmap *masks[10]; 137 QBitmap *masks[10];
137 QPixmap *buttonPixUp[10]; 138 QPixmap *buttonPixUp[10];
138 QPixmap *buttonPixDown[10]; 139 QPixmap *buttonPixDown[10];
139 140
140 QPixmap *pixmaps[4]; 141 QPixmap *pixmaps[4];
141 Ticker songInfo; 142 Ticker songInfo;
142 QSlider slider; 143 QSlider slider;
143 QLineEdit time; 144 QLineEdit time;
144 int xoff, yoff; 145 int xoff, yoff;
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index f0a01a1..8b0f501 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -256,97 +256,97 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
256 f.setPixelSize( 20 ); 256 f.setPixelSize( 20 );
257 f.setBold( TRUE ); 257 f.setBold( TRUE );
258 p.setFont( f ); 258 p.setFont( f );
259 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); 259 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") );
260 260
261 for ( unsigned int i = 0; i < 10; i++ ) { 261 for ( unsigned int i = 0; i < 10; i++ ) {
262 if ( v > i ) { 262 if ( v > i ) {
263 p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 263 p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
264 } else { 264 } else {
265 p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 265 p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
266 } 266 }
267 } 267 }
268 } else { 268 } else {
269 w = videoUI->width(); 269 w = videoUI->width();
270 h = videoUI->height(); 270 h = videoUI->height();
271 271
272 if ( drawnOnScreenDisplay ) { 272 if ( drawnOnScreenDisplay ) {
273 if ( onScreenDisplayVolume > v ) { 273 if ( onScreenDisplayVolume > v ) {
274 videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); 274 videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE );
275 } 275 }
276 } 276 }
277 drawnOnScreenDisplay = TRUE; 277 drawnOnScreenDisplay = TRUE;
278 onScreenDisplayVolume = v; 278 onScreenDisplayVolume = v;
279 QPainter p( videoUI ); 279 QPainter p( videoUI );
280 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 280 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
281 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 281 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
282 282
283 QFont f; 283 QFont f;
284 f.setPixelSize( 20 ); 284 f.setPixelSize( 20 );
285 f.setBold( TRUE ); 285 f.setBold( TRUE );
286 p.setFont( f ); 286 p.setFont( f );
287 p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); 287 p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) );
288 288
289 for ( unsigned int i = 0; i < 10; i++ ) { 289 for ( unsigned int i = 0; i < 10; i++ ) {
290 if ( v > i ) { 290 if ( v > i ) {
291 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 291 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
292 } else { 292 } else {
293 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 293 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
294 } 294 }
295 } 295 }
296 } 296 }
297} 297}
298 298
299 299
300void MediaPlayer::blank( bool b ) { 300void MediaPlayer::blank( bool b ) {
301 fd=open("/dev/fb0",O_RDWR); 301 fd=open("/dev/fb0",O_RDWR);
302#ifdef QT_QWS_EBX 302#ifdef QT_QWS_EBX
303 fl= open( "/dev/fl", O_RDWR ); 303 fl= open( "/dev/fl", O_RDWR );
304#endif 304#endif
305 if (fd != -1) { 305 if (fd != -1) {
306 if ( b ) { 306 if ( b ) {
307 qDebug("do blanking"); 307 qDebug("do blanking");
308#ifdef QT_QWS_EBX 308#ifdef QT_QWS_EBX
309 ioctl( fd, FBIOBLANK, 1 ); 309 ioctl( fd, FBIOBLANK, 1 );
310 if(fl !=-1) { 310 if(fl !=-1) {
311 ioctl( fl, 2 ); 311 ioctl( fl, 2 );
312 ::close(fl); 312 ::close(fl);
313 } 313 }
314#else 314#else
315 ioctl( fd, FBIOBLANK, 3 ); 315 ioctl( fd, FBIOBLANK, 3 );
316#endif 316#endif
317 isBlanked = TRUE; 317 isBlanked = TRUE;
318 } else { 318 } else {
319 qDebug("do unblanking"); 319 qDebug("do unblanking");
320 ioctl( fd, FBIOBLANK, 0); 320 ioctl( fd, FBIOBLANK, 0);
321#ifdef QT_QWS_EBX 321#ifdef QT_QWS_EBX
322 if(fl != -1) { 322 if(fl != -1) {
323 ioctl( fl, 1); 323 ioctl( fl, 1);
324 ::close(fl); 324 ::close(fl);
325 } 325 }
326#endif 326#endif
327 isBlanked = FALSE; 327 isBlanked = FALSE;
328 } 328 }
329 close( fd ); 329 close( fd );
330 } else { 330 } else {
331 qDebug("<< /dev/fb0 could not be opened >>"); 331 qDebug("<< /dev/fb0 could not be opened >>");
332 } 332 }
333} 333}
334 334
335void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 335void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
336 switch ( e->key() ) { 336 switch ( e->key() ) {
337////////////////////////////// Zaurus keys 337////////////////////////////// Zaurus keys
338 case Key_Home: 338 case Key_Home:
339 break; 339 break;
340 case Key_F9: //activity 340 case Key_F9: //activity
341 break; 341 break;
342 case Key_F10: //contacts 342 case Key_F10: //contacts
343 break; 343 break;
344 case Key_F11: //menu 344 case Key_F11: //menu
345 break; 345 break;
346 case Key_F12: //home 346 case Key_F12: //home
347 qDebug("Blank here"); 347 qDebug("Blank here");
348// mediaPlayerState->toggleBlank(); 348// mediaPlayerState->toggleBlank();
349 break; 349 break;
350 case Key_F13: //mail 350 case Key_F13: //mail
351 qDebug("Blank here"); 351 qDebug("Blank here");
352 // mediaPlayerState->toggleBlank(); 352 // mediaPlayerState->toggleBlank();
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index 4ec5989..0b33dfd 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -7,193 +7,207 @@
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// this file is based on work by trolltech 34// this file is based on work by trolltech
35 35
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37#include <qpe/qlibrary.h> 37#include <qpe/qlibrary.h>
38#include <qpe/config.h> 38#include <qpe/config.h>
39#include <qvaluelist.h> 39#include <qvaluelist.h>
40#include <qobject.h> 40#include <qobject.h>
41#include <qdir.h> 41#include <qdir.h>
42#include "mediaplayerstate.h" 42#include "mediaplayerstate.h"
43 43
44 44
45 45
46//#define MediaPlayerDebug(x) qDebug x 46//#define MediaPlayerDebug(x) qDebug x
47#define MediaPlayerDebug(x) 47#define MediaPlayerDebug(x)
48 48
49 49
50MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) 50MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
51 : QObject( parent, name ) { 51 : QObject( parent, name ) {
52 Config cfg( "OpiePlayer" ); 52 Config cfg( "OpiePlayer" );
53 readConfig( cfg ); 53 readConfig( cfg );
54 isStreaming = false; 54 isStreaming = false;
55 isSeekable = true;
55} 56}
56 57
57 58
58MediaPlayerState::~MediaPlayerState() { 59MediaPlayerState::~MediaPlayerState() {
59} 60}
60 61
61 62
62void MediaPlayerState::readConfig( Config& cfg ) { 63void MediaPlayerState::readConfig( Config& cfg ) {
63 cfg.setGroup("Options"); 64 cfg.setGroup("Options");
64 isFullscreen = cfg.readBoolEntry( "FullScreen" ); 65 isFullscreen = cfg.readBoolEntry( "FullScreen" );
65 isScaled = cfg.readBoolEntry( "Scaling" ); 66 isScaled = cfg.readBoolEntry( "Scaling" );
66 isLooping = cfg.readBoolEntry( "Looping" ); 67 isLooping = cfg.readBoolEntry( "Looping" );
67 isShuffled = cfg.readBoolEntry( "Shuffle" ); 68 isShuffled = cfg.readBoolEntry( "Shuffle" );
68 usePlaylist = cfg.readBoolEntry( "UsePlayList" ); 69 usePlaylist = cfg.readBoolEntry( "UsePlayList" );
69 videoGamma = cfg.readNumEntry( "VideoGamma" ); 70 videoGamma = cfg.readNumEntry( "VideoGamma" );
70 usePlaylist = TRUE; 71 usePlaylist = TRUE;
71 isPlaying = FALSE; 72 isPlaying = FALSE;
72 isStreaming = FALSE; 73 isStreaming = FALSE;
73 isPaused = FALSE; 74 isPaused = FALSE;
74 curPosition = 0; 75 curPosition = 0;
75 curLength = 0; 76 curLength = 0;
76 curView = 'l'; 77 curView = 'l';
77} 78}
78 79
79 80
80void MediaPlayerState::writeConfig( Config& cfg ) const { 81void MediaPlayerState::writeConfig( Config& cfg ) const {
81 cfg.setGroup( "Options" ); 82 cfg.setGroup( "Options" );
82 cfg.writeEntry( "FullScreen", isFullscreen ); 83 cfg.writeEntry( "FullScreen", isFullscreen );
83 cfg.writeEntry( "Scaling", isScaled ); 84 cfg.writeEntry( "Scaling", isScaled );
84 cfg.writeEntry( "Looping", isLooping ); 85 cfg.writeEntry( "Looping", isLooping );
85 cfg.writeEntry( "Shuffle", isShuffled ); 86 cfg.writeEntry( "Shuffle", isShuffled );
86 cfg.writeEntry( "UsePlayList", usePlaylist ); 87 cfg.writeEntry( "UsePlayList", usePlaylist );
87 cfg.writeEntry( "VideoGamma", videoGamma ); 88 cfg.writeEntry( "VideoGamma", videoGamma );
88} 89}
89 90
90 91
91// public stuff 92// public stuff
92 93
93 94
94bool MediaPlayerState::streaming() { 95bool MediaPlayerState::streaming() {
95 return isStreaming; 96 return isStreaming;
96} 97}
97 98
99bool MediaPlayerState::seekable() {
100 return isSeekable;
101}
102
98bool MediaPlayerState::fullscreen() { 103bool MediaPlayerState::fullscreen() {
99 return isFullscreen; 104 return isFullscreen;
100} 105}
101 106
102bool MediaPlayerState::scaled() { 107bool MediaPlayerState::scaled() {
103 return isScaled; 108 return isScaled;
104} 109}
105 110
106bool MediaPlayerState::looping() { 111bool MediaPlayerState::looping() {
107 return isLooping; 112 return isLooping;
108} 113}
109 114
110bool MediaPlayerState::shuffled() { 115bool MediaPlayerState::shuffled() {
111 return isShuffled; 116 return isShuffled;
112} 117}
113 118
114 119
115bool MediaPlayerState:: playlist() { 120bool MediaPlayerState::playlist() {
116 return usePlaylist; 121 return usePlaylist;
117} 122}
118 123
119bool MediaPlayerState::paused() { 124bool MediaPlayerState::paused() {
120 return isPaused; 125 return isPaused;
121} 126}
122 127
123bool MediaPlayerState::playing() { 128bool MediaPlayerState::playing() {
124 return isPlaying; 129 return isPlaying;
125} 130}
126 131
127bool MediaPlayerState::stop() { 132bool MediaPlayerState::stop() {
128 return isStoped; 133 return isStoped;
129} 134}
130 135
131long MediaPlayerState::position() { 136long MediaPlayerState::position() {
132 return curPosition; 137 return curPosition;
133} 138}
134 139
135long MediaPlayerState::length() { 140long MediaPlayerState::length() {
136 return curLength; 141 return curLength;
137} 142}
138 143
139char MediaPlayerState::view() { 144char MediaPlayerState::view() {
140 return curView; 145 return curView;
141} 146}
142 147
143// slots 148// slots
144void MediaPlayerState::setIsStreaming( bool b ) { 149void MediaPlayerState::setIsStreaming( bool b ) {
145 150
146 if ( isStreaming == b ) { 151 if ( isStreaming == b ) {
147 return; 152 return;
148 } 153 }
149 isStreaming = b; 154 isStreaming = b;
150} 155}
151 156
157void MediaPlayerState::setIsSeekable( bool b ) {
158
159 //if ( isSeekable == b ) {
160 // return;
161 // }
162 isSeekable = b;
163 emit isSeekableToggled(b);
164}
165
152 166
153void MediaPlayerState::setFullscreen( bool b ) { 167void MediaPlayerState::setFullscreen( bool b ) {
154 if ( isFullscreen == b ) { 168 if ( isFullscreen == b ) {
155 return; 169 return;
156 } 170 }
157 isFullscreen = b; 171 isFullscreen = b;
158 emit fullscreenToggled(b); 172 emit fullscreenToggled(b);
159} 173}
160 174
161 175
162void MediaPlayerState::setBlanked( bool b ) { 176void MediaPlayerState::setBlanked( bool b ) {
163 if ( isBlanked == b ) { 177 if ( isBlanked == b ) {
164 return; 178 return;
165 } 179 }
166 isBlanked = b; 180 isBlanked = b;
167 emit blankToggled(b); 181 emit blankToggled(b);
168} 182}
169 183
170 184
171void MediaPlayerState::setScaled( bool b ) { 185void MediaPlayerState::setScaled( bool b ) {
172 if ( isScaled == b ) { 186 if ( isScaled == b ) {
173 return; 187 return;
174 } 188 }
175 isScaled = b; 189 isScaled = b;
176 emit scaledToggled(b); 190 emit scaledToggled(b);
177} 191}
178 192
179void MediaPlayerState::setLooping( bool b ) { 193void MediaPlayerState::setLooping( bool b ) {
180 if ( isLooping == b ) { 194 if ( isLooping == b ) {
181 return; 195 return;
182 } 196 }
183 isLooping = b; 197 isLooping = b;
184 emit loopingToggled(b); 198 emit loopingToggled(b);
185} 199}
186 200
187void MediaPlayerState::setShuffled( bool b ) { 201void MediaPlayerState::setShuffled( bool b ) {
188 if ( isShuffled == b ) { 202 if ( isShuffled == b ) {
189 return; 203 return;
190 } 204 }
191 isShuffled = b; 205 isShuffled = b;
192 emit shuffledToggled(b); 206 emit shuffledToggled(b);
193} 207}
194 208
195void MediaPlayerState::setPlaylist( bool b ) { 209void MediaPlayerState::setPlaylist( bool b ) {
196 if ( usePlaylist == b ) { 210 if ( usePlaylist == b ) {
197 return; 211 return;
198 } 212 }
199 usePlaylist = b; 213 usePlaylist = b;
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h
index 4fef8e0..8c4e09e 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.h
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h
@@ -9,131 +9,135 @@
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// this file is based on work by trolltech 34// this file is based on work by trolltech
35 35
36#ifndef MEDIA_PLAYER_STATE_H 36#ifndef MEDIA_PLAYER_STATE_H
37#define MEDIA_PLAYER_STATE_H 37#define MEDIA_PLAYER_STATE_H
38 38
39 39
40#include <qobject.h> 40#include <qobject.h>
41 41
42 42
43class MediaPlayerDecoder; 43class MediaPlayerDecoder;
44class Config; 44class Config;
45 45
46 46
47class MediaPlayerState : public QObject { 47class MediaPlayerState : public QObject {
48Q_OBJECT 48Q_OBJECT
49public: 49public:
50 MediaPlayerState( QObject *parent, const char *name ); 50 MediaPlayerState( QObject *parent, const char *name );
51 ~MediaPlayerState(); 51 ~MediaPlayerState();
52 52
53 bool isPaused; 53 bool isPaused;
54 bool isPlaying; 54 bool isPlaying;
55 bool isStoped; 55 bool isStoped;
56 bool streaming(); 56 bool streaming();
57 bool seekable();
57 bool fullscreen(); 58 bool fullscreen();
58 bool scaled(); 59 bool scaled();
59 bool looping(); 60 bool looping();
60 bool shuffled(); 61 bool shuffled();
61 bool playlist(); 62 bool playlist();
62 bool paused(); 63 bool paused();
63 bool playing(); 64 bool playing();
64 bool stop(); 65 bool stop();
65 long position(); 66 long position();
66 long length(); 67 long length();
67 char view(); 68 char view();
68 69
69public slots: 70public slots:
70 void setIsStreaming( bool b ); 71 void setIsStreaming( bool b );
72 void setIsSeekable( bool b );
71 void setFullscreen( bool b ); 73 void setFullscreen( bool b );
72 void setScaled( bool b ); 74 void setScaled( bool b );
73 void setLooping( bool b ); 75 void setLooping( bool b );
74 void setShuffled( bool b ); 76 void setShuffled( bool b );
75 void setPlaylist( bool b ); 77 void setPlaylist( bool b );
76 void setPaused( bool b ); 78 void setPaused( bool b );
77 void setPlaying( bool b ); 79 void setPlaying( bool b );
78 void setStop( bool b ); 80 void setStop( bool b );
79 void setPosition( long p ); 81 void setPosition( long p );
80 void updatePosition( long p ); 82 void updatePosition( long p );
81 void setLength( long l ); 83 void setLength( long l );
82 void setView( char v ); 84 void setView( char v );
83 void setBlanked( bool b ); 85 void setBlanked( bool b );
84 void setVideoGamma( int v ); 86 void setVideoGamma( int v );
85 87
86 void setPrev(); 88 void setPrev();
87 void setNext(); 89 void setNext();
88 void setList(); 90 void setList();
89 void setVideo(); 91 void setVideo();
90 void setAudio(); 92 void setAudio();
91 93
92 void toggleFullscreen(); 94 void toggleFullscreen();
93 void toggleScaled(); 95 void toggleScaled();
94 void toggleLooping(); 96 void toggleLooping();
95 void toggleShuffled(); 97 void toggleShuffled();
96 void togglePlaylist(); 98 void togglePlaylist();
97 void togglePaused(); 99 void togglePaused();
98 void togglePlaying(); 100 void togglePlaying();
99 void toggleBlank(); 101 void toggleBlank();
100 void writeConfig( Config& cfg ) const; 102 void writeConfig( Config& cfg ) const;
101 103
102 104
103signals: 105signals:
104 void fullscreenToggled( bool ); 106 void fullscreenToggled( bool );
105 void scaledToggled( bool ); 107 void scaledToggled( bool );
106 void loopingToggled( bool ); 108 void loopingToggled( bool );
107 void shuffledToggled( bool ); 109 void shuffledToggled( bool );
108 void playlistToggled( bool ); 110 void playlistToggled( bool );
109 void pausedToggled( bool ); 111 void pausedToggled( bool );
110 void playingToggled( bool ); 112 void playingToggled( bool );
111 void stopToggled( bool ); 113 void stopToggled( bool );
112 void positionChanged( long ); // When the slider is moved 114 void positionChanged( long ); // When the slider is moved
113 void positionUpdated( long ); // When the media file progresses 115 void positionUpdated( long ); // When the media file progresses
114 void lengthChanged( long ); 116 void lengthChanged( long );
115 void viewChanged( char ); 117 void viewChanged( char );
118 void isSeekableToggled( bool );
116 void blankToggled( bool ); 119 void blankToggled( bool );
117 void videoGammaChanged( int ); 120 void videoGammaChanged( int );
118 void prev(); 121 void prev();
119 void next(); 122 void next();
120 123
121private: 124private:
122 bool isStreaming; 125 bool isStreaming;
126 bool isSeekable;
123 bool isFullscreen; 127 bool isFullscreen;
124 bool isScaled; 128 bool isScaled;
125 bool isBlanked; 129 bool isBlanked;
126 bool isLooping; 130 bool isLooping;
127 bool isShuffled; 131 bool isShuffled;
128 bool usePlaylist; 132 bool usePlaylist;
129 long curPosition; 133 long curPosition;
130 long curLength; 134 long curLength;
131 char curView; 135 char curView;
132 int videoGamma; 136 int videoGamma;
133 void readConfig( Config& cfg ); 137 void readConfig( Config& cfg );
134 138
135}; 139};
136 140
137 141
138#endif // MEDIA_PLAYER_STATE_H 142#endif // MEDIA_PLAYER_STATE_H
139 143
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c
index b1f4811..707efeb 100644
--- a/noncore/multimedia/opieplayer2/nullvideo.c
+++ b/noncore/multimedia/opieplayer2/nullvideo.c
@@ -452,97 +452,97 @@ xine_vo_driver_t* init_video_out_plugin( config_values_t* conf,
452 void* video ){ 452 void* video ){
453 null_driver_t *vo; 453 null_driver_t *vo;
454 vo = (null_driver_t*)malloc( sizeof(null_driver_t ) ); 454 vo = (null_driver_t*)malloc( sizeof(null_driver_t ) );
455 455
456 /* memset? */ 456 /* memset? */
457 memset(vo,0, sizeof(null_driver_t ) ); 457 memset(vo,0, sizeof(null_driver_t ) );
458 458
459 vo_scale_init (&vo->sc, 0, 0); 459 vo_scale_init (&vo->sc, 0, 0);
460 460
461 vo->sc.gui_pixel_aspect = 1.0; 461 vo->sc.gui_pixel_aspect = 1.0;
462 462
463 vo->m_show_video = 0; // false 463 vo->m_show_video = 0; // false
464 vo->m_video_fullscreen = 0; 464 vo->m_video_fullscreen = 0;
465 vo->m_is_scaling = 0; 465 vo->m_is_scaling = 0;
466 vo->display_ratio = 1.0; 466 vo->display_ratio = 1.0;
467 vo->gui_width = 16; 467 vo->gui_width = 16;
468 vo->gui_height = 8; 468 vo->gui_height = 8;
469 vo->frameDis = NULL; 469 vo->frameDis = NULL;
470 470
471 /* install callback handlers*/ 471 /* install callback handlers*/
472 vo->vo_driver.get_capabilities = null_get_capabilities; 472 vo->vo_driver.get_capabilities = null_get_capabilities;
473 vo->vo_driver.alloc_frame = null_alloc_frame; 473 vo->vo_driver.alloc_frame = null_alloc_frame;
474 vo->vo_driver.update_frame_format = null_update_frame_format; 474 vo->vo_driver.update_frame_format = null_update_frame_format;
475 vo->vo_driver.display_frame = null_display_frame; 475 vo->vo_driver.display_frame = null_display_frame;
476 vo->vo_driver.overlay_blend = null_overlay_blend; 476 vo->vo_driver.overlay_blend = null_overlay_blend;
477 vo->vo_driver.get_property = null_get_property; 477 vo->vo_driver.get_property = null_get_property;
478 vo->vo_driver.set_property = null_set_property; 478 vo->vo_driver.set_property = null_set_property;
479 vo->vo_driver.get_property_min_max = null_get_property_min_max; 479 vo->vo_driver.get_property_min_max = null_get_property_min_max;
480 vo->vo_driver.gui_data_exchange = null_gui_data_exchange; 480 vo->vo_driver.gui_data_exchange = null_gui_data_exchange;
481 vo->vo_driver.dispose = null_dispose; 481 vo->vo_driver.dispose = null_dispose;
482 vo->vo_driver.redraw_needed = null_redraw_needed; 482 vo->vo_driver.redraw_needed = null_redraw_needed;
483 483
484 484
485 /* capabilities */ 485 /* capabilities */
486 vo->m_capabilities = VO_CAP_COPIES_IMAGE | VO_CAP_YUY2 | VO_CAP_YV12; 486 vo->m_capabilities = VO_CAP_COPIES_IMAGE | VO_CAP_YUY2 | VO_CAP_YV12;
487 vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap, 487 vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap,
488 vo->yuv2rgb_cmap); 488 vo->yuv2rgb_cmap);
489 489
490 return ( xine_vo_driver_t*) vo; 490 return ( xine_vo_driver_t*) vo;
491} 491}
492 492
493#if 0 493#if 0
494static vo_info_t vo_info_null = { 494static vo_info_t vo_info_null = {
495 5, 495 5,
496 XINE_VISUAL_TYPE_FB 496 XINE_VISUAL_TYPE_FB
497}; 497};
498 498
499vo_info_t *get_video_out_plugin_info(){ 499vo_info_t *get_video_out_plugin_info(){
500 vo_info_null.description = _("xine video output plugin using null device"); 500 vo_info_null.description = ("xine video output plugin using null device");
501 return &vo_info_null; 501 return &vo_info_null;
502} 502}
503 503
504#endif 504#endif
505 505
506/* this is special for this device */ 506/* this is special for this device */
507/** 507/**
508 * We know that we will be controled by the XINE LIB++ 508 * We know that we will be controled by the XINE LIB++
509 */ 509 */
510 510
511/** 511/**
512 * 512 *
513 */ 513 */
514int null_is_showing_video( xine_vo_driver_t* self ){ 514int null_is_showing_video( xine_vo_driver_t* self ){
515 null_driver_t* this = (null_driver_t*)self; 515 null_driver_t* this = (null_driver_t*)self;
516 return this->m_show_video; 516 return this->m_show_video;
517} 517}
518void null_set_show_video( xine_vo_driver_t* self, int show ) { 518void null_set_show_video( xine_vo_driver_t* self, int show ) {
519 ((null_driver_t*)self)->m_show_video = show; 519 ((null_driver_t*)self)->m_show_video = show;
520} 520}
521 521
522int null_is_fullscreen( xine_vo_driver_t* self ){ 522int null_is_fullscreen( xine_vo_driver_t* self ){
523 return ((null_driver_t*)self)->m_video_fullscreen; 523 return ((null_driver_t*)self)->m_video_fullscreen;
524} 524}
525void null_set_fullscreen( xine_vo_driver_t* self, int screen ){ 525void null_set_fullscreen( xine_vo_driver_t* self, int screen ){
526 ((null_driver_t*)self)->m_video_fullscreen = screen; 526 ((null_driver_t*)self)->m_video_fullscreen = screen;
527} 527}
528int null_is_scaling( xine_vo_driver_t* self ){ 528int null_is_scaling( xine_vo_driver_t* self ){
529 return ((null_driver_t*)self)->m_is_scaling; 529 return ((null_driver_t*)self)->m_is_scaling;
530} 530}
531 531
532void null_set_videoGamma( xine_vo_driver_t* self , int value ) { 532void null_set_videoGamma( xine_vo_driver_t* self , int value ) {
533 ((null_driver_t*) self) ->yuv2rgb_gamma = value; 533 ((null_driver_t*) self) ->yuv2rgb_gamma = value;
534 ((null_driver_t*) self) ->yuv2rgb_factory->set_gamma( ((null_driver_t*) self) ->yuv2rgb_factory, value ); 534 ((null_driver_t*) self) ->yuv2rgb_factory->set_gamma( ((null_driver_t*) self) ->yuv2rgb_factory, value );
535} 535}
536 536
537void null_set_scaling( xine_vo_driver_t* self, int scale ) { 537void null_set_scaling( xine_vo_driver_t* self, int scale ) {
538 ((null_driver_t*)self)->m_is_scaling = scale; 538 ((null_driver_t*)self)->m_is_scaling = scale;
539} 539}
540 540
541void null_set_gui_width( xine_vo_driver_t* self, int width ) { 541void null_set_gui_width( xine_vo_driver_t* self, int width ) {
542 ((null_driver_t*)self)->gui_width = width; 542 ((null_driver_t*)self)->gui_width = width;
543} 543}
544void null_set_gui_height( xine_vo_driver_t* self, int height ) { 544void null_set_gui_height( xine_vo_driver_t* self, int height ) {
545 ((null_driver_t*)self)->gui_height = height; 545 ((null_driver_t*)self)->gui_height = height;
546} 546}
547 547
548 548
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 7b8ad7a..7d71d09 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -339,113 +339,112 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
339 return; 339 return;
340 } else { 340 } else {
341 return; 341 return;
342 } 342 }
343 } 343 }
344 344
345 case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; 345 case VideoStop: mediaPlayerState->setPlaying( FALSE ); return;
346 case VideoNext: if(playList->whichList() ==0) mediaPlayerState->setNext(); return; 346 case VideoNext: if(playList->whichList() ==0) mediaPlayerState->setNext(); return;
347 case VideoPrevious: if(playList->whichList() ==0) mediaPlayerState->setPrev(); return; 347 case VideoPrevious: if(playList->whichList() ==0) mediaPlayerState->setPrev(); return;
348 case VideoVolUp: emit moreReleased(); return; 348 case VideoVolUp: emit moreReleased(); return;
349 case VideoVolDown: emit lessReleased(); return; 349 case VideoVolDown: emit lessReleased(); return;
350 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; 350 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
351 } 351 }
352 } 352 }
353 } 353 }
354 } 354 }
355} 355}
356 356
357void VideoWidget::mousePressEvent( QMouseEvent *event ) { 357void VideoWidget::mousePressEvent( QMouseEvent *event ) {
358 mouseMoveEvent( event ); 358 mouseMoveEvent( event );
359} 359}
360 360
361void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 361void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
362 if ( mediaPlayerState->fullscreen() ) { 362 if ( mediaPlayerState->fullscreen() ) {
363 mediaPlayerState->setFullscreen( FALSE ); 363 mediaPlayerState->setFullscreen( FALSE );
364 makeVisible(); 364 makeVisible();
365 } 365 }
366 mouseMoveEvent( event ); 366 mouseMoveEvent( event );
367} 367}
368 368
369void VideoWidget::showEvent( QShowEvent* ) { 369void VideoWidget::showEvent( QShowEvent* ) {
370 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 370 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
371 mouseMoveEvent( &event ); 371 mouseMoveEvent( &event );
372} 372}
373 373
374 374
375 void VideoWidget::backToNormal() { 375 void VideoWidget::backToNormal() {
376 mediaPlayerState->setFullscreen( FALSE ); 376 mediaPlayerState->setFullscreen( FALSE );
377 makeVisible(); 377 makeVisible();
378 } 378 }
379 379
380void VideoWidget::makeVisible() { 380void VideoWidget::makeVisible() {
381 if ( mediaPlayerState->fullscreen() ) { 381 if ( mediaPlayerState->fullscreen() ) {
382 setBackgroundMode( QWidget::NoBackground ); 382 setBackgroundMode( QWidget::NoBackground );
383 showFullScreen(); 383 showFullScreen();
384 resize( qApp->desktop()->size() ); 384 resize( qApp->desktop()->size() );
385 slider->hide(); 385 slider->hide();
386 videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); 386 videoFrame-> setGeometry ( 0, 0, width ( ), height ( ));
387// qApp->processEvents();
388 } else { 387 } else {
389 showNormal(); 388 showNormal();
390 showMaximized(); 389 showMaximized();
391 setBackgroundPixmap( *pixBg ); 390 setBackgroundPixmap( *pixBg );
392 if ( mediaPlayerState->streaming() ) { 391 if ( mediaPlayerState->seekable() ) {
393 slider->hide(); 392 slider->hide();
394 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 393 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
395 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 394 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
396 } else { 395 } else {
397 slider->show(); 396 slider->show();
398 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 397 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
399 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 398 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
400 } 399 }
401 QWidget *d = QApplication::desktop(); 400 QWidget *d = QApplication::desktop();
402 int w=d->width(); 401 int w = d->width();
403 int h=d->height(); 402 int h = d->height();
404 403
405 if(w>h) { 404 if(w>h) {
406 int newW=(w/2)-(246/2); //this will only work with 320x240 405 int newW=(w/2)-(246/2); //this will only work with 320x240
407 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); 406 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) );
408 } else 407 } else
409 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); 408 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) );
410 409
411// qApp->processEvents(); 410// qApp->processEvents();
412 } 411 }
413} 412}
414 413
415 414
416void VideoWidget::paintEvent( QPaintEvent * pe) { 415void VideoWidget::paintEvent( QPaintEvent * pe) {
417 QPainter p( this ); 416 QPainter p( this );
418 417
419 if ( mediaPlayerState->fullscreen() ) { 418 if ( mediaPlayerState->fullscreen() ) {
420 // Clear the background 419 // Clear the background
421 p.setBrush( QBrush( Qt::black ) ); 420 p.setBrush( QBrush( Qt::black ) );
422 } else { 421 } else {
423 if ( !pe->erased() ) { 422 if ( !pe->erased() ) {
424 // Combine with background and double buffer 423 // Combine with background and double buffer
425 QPixmap pix( pe->rect().size() ); 424 QPixmap pix( pe->rect().size() );
426 QPainter p( &pix ); 425 QPainter p( &pix );
427 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 426 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
428 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); 427 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
429 for ( int i = 0; i < numVButtons; i++ ) { 428 for ( int i = 0; i < numVButtons; i++ ) {
430 paintButton( &p, i ); 429 paintButton( &p, i );
431 } 430 }
432 QPainter p2( this ); 431 QPainter p2( this );
433 p2.drawPixmap( pe->rect().topLeft(), pix ); 432 p2.drawPixmap( pe->rect().topLeft(), pix );
434 } else { 433 } else {
435 QPainter p( this ); 434 QPainter p( this );
436 for ( int i = 0; i < numVButtons; i++ ) 435 for ( int i = 0; i < numVButtons; i++ )
437 paintButton( &p, i ); 436 paintButton( &p, i );
438 } 437 }
439 //slider->repaint( TRUE ); 438 //slider->repaint( TRUE );
440 } 439 }
441} 440}
442 441
443 442
444void VideoWidget::closeEvent( QCloseEvent* ) { 443void VideoWidget::closeEvent( QCloseEvent* ) {
445 mediaPlayerState->setList(); 444 mediaPlayerState->setList();
446} 445}
447 446
448 447
449 448
450void VideoWidget::keyReleaseEvent( QKeyEvent *e) { 449void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
451 switch ( e->key() ) { 450 switch ( e->key() ) {
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 03176b3..65ac127 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -30,121 +30,122 @@
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, 0, 0 ) ) {
81 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 81 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
82 // toggle stop so the the play button is reset 82 // toggle stop so the the play button is reset
83 mediaPlayerState->setPlaying( false ); 83 mediaPlayerState->setPlaying( false );
84 return; 84 return;
85 } 85 }
86 mediaPlayerState->setPlaying( true ); 86 mediaPlayerState->setPlaying( true );
87 87
88 char whichGui; 88 char whichGui;
89 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); 89 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) );
90 if ( !libXine->hasVideo() ) { 90 if ( !libXine->hasVideo() ) {
91 whichGui = 'a'; 91 whichGui = 'a';
92 qDebug("HAS AUDIO"); 92 qDebug("HAS AUDIO");
93 libXine->setShowVideo( false ); 93 libXine->setShowVideo( false );
94 hasAudioChannel = TRUE; 94 hasAudioChannel = TRUE;
95 } else { 95 } else {
96 whichGui = 'v'; 96 whichGui = 'v';
97 qDebug("HAS VIDEO"); 97 qDebug("HAS VIDEO");
98 libXine->setShowVideo( true ); 98 libXine->setShowVideo( true );
99 hasVideoChannel = TRUE; 99 hasVideoChannel = TRUE;
100 } 100 }
101 // determine if slider is shown 101 // determine if slider is shown
102 mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); 102 mediaPlayerState->setIsSeekable( !libXine->isSeekable() );
103
103 // which gui (video / audio) 104 // which gui (video / audio)
104 mediaPlayerState->setView( whichGui ); 105 mediaPlayerState->setView( whichGui );
105 106
106#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 107#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
107 if ( !disabledSuspendScreenSaver ) { 108 if ( !disabledSuspendScreenSaver ) {
108 disabledSuspendScreenSaver = TRUE; 109 disabledSuspendScreenSaver = TRUE;
109 // Stop the screen from blanking and power saving state 110 // Stop the screen from blanking and power saving state
110 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) 111 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" )
111 << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 112 << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend );
112 } 113 }
113#endif 114#endif
114 115
115 length(); 116 length();
116 position(); 117 position();
117} 118}
118 119
119void XineControl::nextMedia() { 120void XineControl::nextMedia() {
120 mediaPlayerState->setNext(); 121 mediaPlayerState->setNext();
121} 122}
122 123
123void XineControl::setGamma( int value ) { 124void XineControl::setGamma( int value ) {
124 libXine->setGamma( value ); 125 libXine->setGamma( value );
125} 126}
126 127
127void XineControl::stop( bool isSet ) { 128void XineControl::stop( bool isSet ) {
128 if ( !isSet ) { 129 if ( !isSet ) {
129 libXine->stop(); 130 libXine->stop();
130 131
131#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 132#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
132 if ( disabledSuspendScreenSaver ) { 133 if ( disabledSuspendScreenSaver ) {
133 disabledSuspendScreenSaver = FALSE; 134 disabledSuspendScreenSaver = FALSE;
134 // Re-enable the suspend mode 135 // Re-enable the suspend mode
135 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 136 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
136 } 137 }
137#endif 138#endif
138 } 139 }
139} 140}
140 141
141/** 142/**
142 * Pause playback 143 * Pause playback
143 * @isSet 144 * @isSet
144 */ 145 */
145void XineControl::pause( bool isSet) { 146void XineControl::pause( bool isSet) {
146 if ( isSet ) { 147 if ( isSet ) {
147 libXine->pause(); 148 libXine->pause();
148 } else { 149 } else {
149 libXine->play( m_fileName, 0, m_currentTime ); 150 libXine->play( m_fileName, 0, m_currentTime );
150 } 151 }