summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp23
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp22
2 files changed, 35 insertions, 10 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 300a5c8..303834a 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -77,49 +77,49 @@ MediaButton audioButtons[] = {
{ FALSE, FALSE, FALSE }, // playlist
{ FALSE, FALSE, FALSE }, // forward
{ FALSE, FALSE, FALSE } // back
};
const char *skin_mask_file_names[11] = {
"play", "stop", "pause", "next", "prev", "up",
"down", "loop", "playlist", "forward", "back"
};
static void changeTextColor( QWidget *w ) {
QPalette p = w->palette();
p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
w->setPalette( p );
}
static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) {
setCaption( tr("OpiePlayer") );
-
+
Config cfg("OpiePlayer");
cfg.setGroup("AudioWidget");
skin = cfg.readEntry("Skin","default");
//skin = "scaleTest";
// color of background, frame, degree of transparency
QString skinPath = "opieplayer/skins/" + skin;
pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
imgButtonMask->fill( 0 );
for ( int i = 0; i < 11; i++ ) {
QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png";
masks[i] = new QBitmap( filename );
if ( !masks[i]->isNull() ) {
QImage imgMask = masks[i]->convertToImage();
uchar **dest = imgButtonMask->jumpTable();
for ( int y = 0; y < imgUp->height(); y++ ) {
uchar *line = dest[y];
for ( int x = 0; x < imgUp->width(); x++ )
@@ -230,90 +230,97 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
}
}
delete pixUp;
delete pixDn;
}
static bool audioSliderBeingMoved = FALSE;
void AudioWidget::sliderPressed() {
audioSliderBeingMoved = TRUE;
}
void AudioWidget::sliderReleased() {
audioSliderBeingMoved = FALSE;
if ( slider.width() == 0 )
return;
long val = long((double)slider.value() * mediaPlayerState->length() / slider.width());
mediaPlayerState->setPosition( val );
}
void AudioWidget::setPosition( long i ) {
- // qDebug("set position %d",i);
+ qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
updateSlider( i, mediaPlayerState->length() );
}
void AudioWidget::setLength( long max ) {
updateSlider( mediaPlayerState->position(), max );
}
void AudioWidget::setView( char view ) {
- if (mediaPlayerState->streaming() ) {
- if( !slider.isHidden()) slider.hide();
- disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
- disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
- } else {
+ slider.show();
+
+// this isnt working for some reason
+
+// if ( mediaPlayerState->streaming() ) {
+// qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
+// if( !slider.isHidden()) slider.hide();
+// disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
+// disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
+// } else {
// this stops the slider from being moved, thus
// does not stop stream when it reaches the end
slider.show();
connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
- }
+// }
if ( view == 'a' ) {
startTimer( 150 );
showMaximized();
} else {
killTimers();
hide();
}
}
static QString timeAsString( long length ) {
length /= 44100;
int minutes = length / 60;
int seconds = length % 60;
return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 );
}
void AudioWidget::updateSlider( long i, long max ) {
+
time.setText( timeAsString( i ) + " / " + timeAsString( max ) );
+
if ( max == 0 ) {
return;
}
// Will flicker too much if we don't do this
// Scale to something reasonable
int width = slider.width();
int val = int((double)i * width / max);
if ( !audioSliderBeingMoved ) {
if ( slider.value() != val ) {
slider.setValue( val );
}
if ( slider.maxValue() != width ) {
slider.setMaxValue( width );
}
}
}
void AudioWidget::setToggleButton( int i, bool down ) {
if ( down != audioButtons[i].isDown ) {
toggleButton( i );
}
}
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 13cc4ed..5411a64 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -50,52 +50,70 @@ void MediaPlayer::pauseCheck( bool b ) {
mediaPlayerState->setPaused( FALSE );
}
}
void MediaPlayer::play() {
mediaPlayerState->setPlaying( FALSE );
mediaPlayerState->setPlaying( TRUE );
}
void MediaPlayer::setPlaying( bool play ) {
if ( !play ) {
mediaPlayerState->setPaused( FALSE );
return;
}
if ( mediaPlayerState->paused() ) {
mediaPlayerState->setPaused( FALSE );
return;
}
const DocLnk *playListCurrent = playList->current();
if ( playListCurrent != NULL ) {
currentFile = playListCurrent;
}
+
+ xineControl->play( currentFile->file() );
- audioUI->setTickerText( currentFile->file( ) );
+ xineControl->length();
+ long seconds = mediaPlayerState->length();//
+ QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
+ qDebug(time);
- xineControl->play( currentFile->file() );
+ QString tickerText;
+ if( currentFile->file().left(4) == "http" )
+ tickerText= tr( " File: " ) + currentFile->name();
+ else
+ tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time;
+
+// QString fileInfo = mediaPlayerState->curDecoder()->fileInfo();
+
+// if ( !fileInfo.isEmpty() )
+// tickerText += ", " + fileInfo;
+// audioUI->setTickerText( tickerText + "." );
+
+ audioUI->setTickerText( currentFile->file( ) );
+
}
void MediaPlayer::prev() {
if ( playList->prev() ) {
play();
} else if ( mediaPlayerState->looping() ) {
if ( playList->last() ) {
play();
}
} else {
mediaPlayerState->setList();
}
}
void MediaPlayer::next() {
if ( playList->next() ) {
play();
} else if ( mediaPlayerState->looping() ) {
if ( playList->first() ) {
play();
}
} else {