author | harlekin <harlekin> | 2002-08-18 23:15:50 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-18 23:15:50 (UTC) |
commit | d92fbca743e676182a8f33ae4c28044031143fb0 (patch) (unidiff) | |
tree | 557b19a000a897e46ed1a8e18a4fdd41aa199e0d | |
parent | bec883a38720a1e1a975e5474a3085d149cf935c (diff) | |
download | opie-d92fbca743e676182a8f33ae4c28044031143fb0.zip opie-d92fbca743e676182a8f33ae4c28044031143fb0.tar.gz opie-d92fbca743e676182a8f33ae4c28044031143fb0.tar.bz2 |
small fixes regarding shoutcast, but for now user need to have http:// anything / as shoutcast url
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 67 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediadetect.cpp | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/opieplayer2.pro | 1 |
4 files changed, 39 insertions, 38 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 6d867e5..bf3590b 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -80,10 +80,11 @@ void Ticker::timerEvent( QTimerEvent * ) { | |||
80 | repaint( FALSE ); | 80 | repaint( FALSE ); |
81 | } | 81 | } |
82 | 82 | ||
83 | void Ticker::drawContents( QPainter *p ) { | 83 | void Ticker::drawContents( QPainter *p ) { |
84 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) | 84 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) { |
85 | p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | 85 | p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); |
86 | } | ||
86 | QPixmap pm( width(), height() ); | 87 | QPixmap pm( width(), height() ); |
87 | pm.fill( colorGroup().base() ); | 88 | pm.fill( colorGroup().base() ); |
88 | QPainter pmp( &pm ); | 89 | QPainter pmp( &pm ); |
89 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) { | 90 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) { |
@@ -92,9 +93,9 @@ void Ticker::drawContents( QPainter *p ) { | |||
92 | p->drawPixmap( 0, 0, pm ); | 93 | p->drawPixmap( 0, 0, pm ); |
93 | } | 94 | } |
94 | 95 | ||
95 | struct MediaButton { | 96 | struct MediaButton { |
96 | bool isToggle, isHeld, isDown; | 97 | bool isToggle, isHeld, isDown; |
97 | }; | 98 | }; |
98 | 99 | ||
99 | //Layout information for the audioButtons (and if it is a toggle button or not) | 100 | //Layout information for the audioButtons (and if it is a toggle button or not) |
100 | MediaButton audioButtons[] = { | 101 | MediaButton audioButtons[] = { |
@@ -126,19 +127,18 @@ static void changeTextColor( QWidget *w ) { | |||
126 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | 127 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); |
127 | 128 | ||
128 | 129 | ||
129 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 130 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
130 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { | ||
131 | |||
132 | 131 | ||
132 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { | ||
133 | 133 | ||
134 | setCaption( tr("OpiePlayer") ); | 134 | setCaption( tr("OpiePlayer") ); |
135 | 135 | ||
136 | Config cfg("OpiePlayer"); | 136 | Config cfg("OpiePlayer"); |
137 | cfg.setGroup("Options"); | 137 | cfg.setGroup("Options"); |
138 | skin = cfg.readEntry("Skin","default"); | 138 | skin = cfg.readEntry("Skin","default"); |
139 | //skin = "scaleTest"; | 139 | //skin = "scaleTest"; |
140 | // color of background, frame, degree of transparency | 140 | // color of background, frame, degree of transparency |
141 | 141 | ||
142 | QString skinPath = "opieplayer2/skins/" + skin; | 142 | QString skinPath = "opieplayer2/skins/" + skin; |
143 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 143 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
144 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | 144 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); |
@@ -192,9 +192,9 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
192 | 192 | ||
193 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 193 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
194 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 194 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
195 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 195 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
196 | // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 196 | // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
197 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 197 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
198 | 198 | ||
199 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | 199 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); |
200 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); | 200 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); |
@@ -206,9 +206,9 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
206 | // Intialise state | 206 | // Intialise state |
207 | setLength( mediaPlayerState->length() ); | 207 | setLength( mediaPlayerState->length() ); |
208 | setPosition( mediaPlayerState->position() ); | 208 | setPosition( mediaPlayerState->position() ); |
209 | setLooping( mediaPlayerState->fullscreen() ); | 209 | setLooping( mediaPlayerState->fullscreen() ); |
210 | // setPaused( mediaPlayerState->paused() ); | 210 | // setPaused( mediaPlayerState->paused() ); |
211 | setPlaying( mediaPlayerState->playing() ); | 211 | setPlaying( mediaPlayerState->playing() ); |
212 | 212 | ||
213 | } | 213 | } |
214 | 214 | ||
@@ -235,10 +235,9 @@ QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | |||
235 | return new QPixmap( pix ); | 235 | return new QPixmap( pix ); |
236 | } | 236 | } |
237 | 237 | ||
238 | 238 | ||
239 | QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) | 239 | QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) { |
240 | { | ||
241 | QPixmap *pixmap = new QPixmap( pix ); | 240 | QPixmap *pixmap = new QPixmap( pix ); |
242 | pixmap->setMask( mask ); | 241 | pixmap->setMask( mask ); |
243 | return pixmap; | 242 | return pixmap; |
244 | } | 243 | } |
@@ -291,9 +290,9 @@ void AudioWidget::sliderReleased() { | |||
291 | mediaPlayerState->setPosition( val ); | 290 | mediaPlayerState->setPosition( val ); |
292 | } | 291 | } |
293 | 292 | ||
294 | void AudioWidget::setPosition( long i ) { | 293 | void AudioWidget::setPosition( long i ) { |
295 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); | 294 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); |
296 | updateSlider( i, mediaPlayerState->length() ); | 295 | updateSlider( i, mediaPlayerState->length() ); |
297 | } | 296 | } |
298 | 297 | ||
299 | 298 | ||
@@ -303,9 +302,9 @@ void AudioWidget::setLength( long max ) { | |||
303 | 302 | ||
304 | 303 | ||
305 | void AudioWidget::setView( char view ) { | 304 | void AudioWidget::setView( char view ) { |
306 | 305 | ||
307 | // this isnt working for some reason | 306 | // this isnt working for some reason |
308 | 307 | ||
309 | if ( mediaPlayerState->streaming() ) { | 308 | if ( mediaPlayerState->streaming() ) { |
310 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); | 309 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); |
311 | if( !slider.isHidden()) { | 310 | if( !slider.isHidden()) { |
@@ -405,10 +404,10 @@ void AudioWidget::stopSkip() { | |||
405 | } | 404 | } |
406 | 405 | ||
407 | 406 | ||
408 | void AudioWidget::timerEvent( QTimerEvent * ) { | 407 | void AudioWidget::timerEvent( QTimerEvent * ) { |
409 | if ( skipDirection == +1 ) { | 408 | if ( skipDirection == +1 ) { |
410 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); | 409 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); |
411 | } else if ( skipDirection == -1 ) { | 410 | } else if ( skipDirection == -1 ) { |
412 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); | 411 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); |
413 | } | 412 | } |
414 | } | 413 | } |
@@ -441,13 +440,12 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
441 | case AudioBack: | 440 | case AudioBack: |
442 | emit backClicked(); | 441 | emit backClicked(); |
443 | return; | 442 | return; |
444 | } | 443 | } |
444 | } else if ( !isOnButton && audioButtons[i].isHeld ) { | ||
445 | audioButtons[i].isHeld = FALSE; | ||
446 | toggleButton(i); | ||
445 | } | 447 | } |
446 | else if ( !isOnButton && audioButtons[i].isHeld ) { | ||
447 | audioButtons[i].isHeld = FALSE; | ||
448 | toggleButton(i); | ||
449 | } | ||
450 | } else { | 448 | } else { |
451 | if ( audioButtons[i].isHeld ) { | 449 | if ( audioButtons[i].isHeld ) { |
452 | audioButtons[i].isHeld = FALSE; | 450 | audioButtons[i].isHeld = FALSE; |
453 | if ( !audioButtons[i].isToggle ) { | 451 | if ( !audioButtons[i].isToggle ) { |
@@ -521,17 +519,16 @@ void AudioWidget::paintEvent( QPaintEvent * pe) { | |||
521 | paintButton( &p, i ); | 519 | paintButton( &p, i ); |
522 | } | 520 | } |
523 | } | 521 | } |
524 | 522 | ||
525 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) | 523 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { |
526 | { | ||
527 | switch ( e->key() ) { | 524 | switch ( e->key() ) { |
528 | ////////////////////////////// Zaurus keys | 525 | ////////////////////////////// Zaurus keys |
529 | case Key_Home: | 526 | case Key_Home: |
530 | break; | 527 | break; |
531 | case Key_F9: //activity | 528 | case Key_F9: //activity |
532 | hide(); | 529 | hide(); |
533 | // qDebug("Audio F9"); | 530 | // qDebug("Audio F9"); |
534 | break; | 531 | break; |
535 | case Key_F10: //contacts | 532 | case Key_F10: //contacts |
536 | break; | 533 | break; |
537 | case Key_F11: //menu | 534 | case Key_F11: //menu |
@@ -543,39 +540,39 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) | |||
543 | mediaPlayerState->toggleBlank(); | 540 | mediaPlayerState->toggleBlank(); |
544 | break; | 541 | break; |
545 | case Key_Space: { | 542 | case Key_Space: { |
546 | if(mediaPlayerState->playing()) { | 543 | if(mediaPlayerState->playing()) { |
547 | // toggleButton(1); | 544 | // toggleButton(1); |
548 | mediaPlayerState->setPlaying(FALSE); | 545 | mediaPlayerState->setPlaying(FALSE); |
549 | // toggleButton(1); | 546 | // toggleButton(1); |
550 | } else { | 547 | } else { |
551 | // toggleButton(0); | 548 | // toggleButton(0); |
552 | mediaPlayerState->setPlaying(TRUE); | 549 | mediaPlayerState->setPlaying(TRUE); |
553 | // toggleButton(0); | 550 | // toggleButton(0); |
554 | } | 551 | } |
555 | } | 552 | } |
556 | break; | 553 | break; |
557 | case Key_Down: | 554 | case Key_Down: |
558 | // toggleButton(6); | 555 | // toggleButton(6); |
559 | emit lessClicked(); | 556 | emit lessClicked(); |
560 | emit lessReleased(); | 557 | emit lessReleased(); |
561 | // toggleButton(6); | 558 | // toggleButton(6); |
562 | break; | 559 | break; |
563 | case Key_Up: | 560 | case Key_Up: |
564 | // toggleButton(5); | 561 | // toggleButton(5); |
565 | emit moreClicked(); | 562 | emit moreClicked(); |
566 | emit moreReleased(); | 563 | emit moreReleased(); |
567 | // toggleButton(5); | 564 | // toggleButton(5); |
568 | break; | 565 | break; |
569 | case Key_Right: | 566 | case Key_Right: |
570 | // toggleButton(3); | 567 | // toggleButton(3); |
571 | mediaPlayerState->setNext(); | 568 | mediaPlayerState->setNext(); |
572 | // toggleButton(3); | 569 | // toggleButton(3); |
573 | break; | 570 | break; |
574 | case Key_Left: | 571 | case Key_Left: |
575 | // toggleButton(4); | 572 | // toggleButton(4); |
576 | mediaPlayerState->setPrev(); | 573 | mediaPlayerState->setPrev(); |
577 | // toggleButton(4); | 574 | // toggleButton(4); |
578 | break; | 575 | break; |
579 | case Key_Escape: { | 576 | case Key_Escape: { |
580 | #if defined(QT_QWS_IPAQ) | 577 | #if defined(QT_QWS_IPAQ) |
581 | if( mediaPlayerState->isPaused ) { | 578 | if( mediaPlayerState->isPaused ) { |
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 39364ab..3a82a50 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -164,10 +164,10 @@ int Lib::play( const QString& fileName, | |||
164 | int startPos, | 164 | int startPos, |
165 | int start_time ) { | 165 | int start_time ) { |
166 | QString str = fileName.stripWhiteSpace(); | 166 | QString str = fileName.stripWhiteSpace(); |
167 | //workaround OpiePlayer bug | 167 | //workaround OpiePlayer bug |
168 | if (str.right(1) == QString::fromLatin1("/") ) | 168 | //f (str.right(1) == QString::fromLatin1("/") ) |
169 | str = str.mid( str.length() -1 ); | 169 | // str = str.mid( str.length() -1 ); |
170 | return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(), | 170 | return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(), |
171 | startPos, start_time); | 171 | startPos, start_time); |
172 | } | 172 | } |
173 | void Lib::stop() { | 173 | void Lib::stop() { |
diff --git a/noncore/multimedia/opieplayer2/mediadetect.cpp b/noncore/multimedia/opieplayer2/mediadetect.cpp index 5e0da88..91137db 100644 --- a/noncore/multimedia/opieplayer2/mediadetect.cpp +++ b/noncore/multimedia/opieplayer2/mediadetect.cpp | |||
@@ -21,10 +21,13 @@ char MediaDetect::videoOrAudio( const QString& fileName ) { | |||
21 | (fileName.lower()).right(4) == ".ogg" || | 21 | (fileName.lower()).right(4) == ".ogg" || |
22 | (fileName.lower()).right(4) == ".wav" ) { | 22 | (fileName.lower()).right(4) == ".wav" ) { |
23 | qDebug("AUDIO out taken"); | 23 | qDebug("AUDIO out taken"); |
24 | return 'a'; | 24 | return 'a'; |
25 | } else if ( (fileName.lower()).left(7) == "http://" && | ||
26 | (fileName.lower()).right(1) == "/" ) { | ||
27 | return 'a'; | ||
25 | } else { | 28 | } else { |
26 | return 'f'; | 29 | return 'f'; |
27 | } | 30 | } |
28 | } | 31 | } |
29 | 32 | ||
30 | bool MediaDetect::isStreaming( const QString& fileName ) { | 33 | bool MediaDetect::isStreaming( const QString& fileName ) { |
diff --git a/noncore/multimedia/opieplayer2/opieplayer2.pro b/noncore/multimedia/opieplayer2/opieplayer2.pro index edc4624..03540a1 100644 --- a/noncore/multimedia/opieplayer2/opieplayer2.pro +++ b/noncore/multimedia/opieplayer2/opieplayer2.pro | |||
@@ -1,6 +1,7 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | #CONFIG = qt warn_on debug | ||
3 | #release | 4 | #release |
4 | DESTDIR = $(OPIEDIR)/bin | 5 | DESTDIR = $(OPIEDIR)/bin |
5 | HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\ | 6 | HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\ |
6 | videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \ | 7 | videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \ |