summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/audiowidget.cpp
Side-by-side diff
Diffstat (limited to 'noncore/multimedia/opieplayer2/audiowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 1b0de5d..125fd72 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -46,54 +46,49 @@ void Ticker::timerEvent( QTimerEvent * ) {
void Ticker::drawContents( QPainter *p ) {
QPixmap pm( width(), height() );
pm.fill( colorGroup().base() );
QPainter pmp( &pm );
for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) {
pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText );
}
p->drawPixmap( 0, 0, pm );
}
-
-
struct MediaButton {
int xPos, yPos;
int color;
bool isToggle, isBig, isHeld, isDown;
};
-
-
// Layout information for the audioButtons (and if it is a toggle button or not)
MediaButton audioButtons[] = {
{ 3*30-15+xo, 3*30-13+yo, 0, TRUE, TRUE, FALSE, FALSE }, // play
{ 1*30+xo, 5*30+yo, 2, FALSE, FALSE, FALSE, FALSE }, // stop
{ 5*30+xo, 5*30+yo, 2, TRUE, FALSE, FALSE, FALSE }, // pause
{ 6*30-5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // next
{ 0*30+5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // previous
{ 3*30+xo, 0*30+5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume up
{ 3*30+xo, 6*30-5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume down
{ 5*30+xo, 1*30+yo, 0, TRUE, FALSE, FALSE, FALSE }, // repeat/loop
{ 1*30+xo, 1*30+yo, 0, FALSE, FALSE, FALSE, FALSE } // playlist
};
static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
- QWidget( parent, name, f )
-{
+ QWidget( parent, name, f ) {
setCaption( tr("OpiePlayer - Audio") );
Config cfg("OpiePlayer");
cfg.setGroup("AudioWidget");
QString backgroundPix, buttonsAllPix, buttonsBigPix, controlsPix, animatedPix;
backgroundPix=cfg.readEntry( " backgroundPix", "opieplayer/metalFinish");
buttonsAllPix=cfg.readEntry( "buttonsAllPix","opieplayer/mediaButtonsAll");
buttonsBigPix=cfg.readEntry( "buttonsBigPix","opieplayer/mediaButtonsBig");
controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls");
setBackgroundPixmap( Resource::loadPixmap( backgroundPix) );
pixmaps[0] = new QPixmap( Resource::loadPixmap( buttonsAllPix ) );
@@ -118,28 +113,26 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
// Intialise state
setLength( mediaPlayerState->length() );
setPosition( mediaPlayerState->position() );
setLooping( mediaPlayerState->fullscreen() );
setPaused( mediaPlayerState->paused() );
setPlaying( mediaPlayerState->playing() );
-
}
-
AudioWidget::~AudioWidget() {
mediaPlayerState->isStreaming = FALSE;
for ( int i = 0; i < 3; i++ ) {
delete pixmaps[i];
}
}
static bool audioSliderBeingMoved = FALSE;
void AudioWidget::sliderPressed() {
@@ -147,25 +140,24 @@ void AudioWidget::sliderPressed() {
}
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);
updateSlider( i, mediaPlayerState->length() );
}
void AudioWidget::setLength( long max ) {
updateSlider( mediaPlayerState->position(), max );
}
void AudioWidget::setView( char view ) {