summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/audiowidget.cpp
Side-by-side diff
Diffstat (limited to 'noncore/multimedia/opieplayer2/audiowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp15
1 files changed, 6 insertions, 9 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
@@ -72,26 +72,27 @@ void Ticker::setText( const QString& text ) {
}
update();
}
void Ticker::timerEvent( QTimerEvent * ) {
pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1;
scroll( -1, 0, contentsRect() );
repaint( FALSE );
}
void Ticker::drawContents( QPainter *p ) {
- for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen )
+ for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) {
p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText );
+ }
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 {
bool isToggle, isHeld, isDown;
};
@@ -118,27 +119,26 @@ const char *skin_mask_file_names[10] = {
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 ) {
-
+ QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) {
setCaption( tr("OpiePlayer") );
Config cfg("OpiePlayer");
cfg.setGroup("Options");
skin = cfg.readEntry("Skin","default");
//skin = "scaleTest";
// color of background, frame, degree of transparency
QString skinPath = "opieplayer2/skins/" + skin;
pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
@@ -227,26 +227,25 @@ AudioWidget::~AudioWidget() {
}
}
QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
QPixmap pix( img.width(), img.height() );
QPainter p( &pix );
p.drawTiledPixmap( pix.rect(), bg, offset );
p.drawImage( 0, 0, img );
return new QPixmap( pix );
}
-QPixmap *maskPixToMask( QPixmap pix, QBitmap mask )
-{
+QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) {
QPixmap *pixmap = new QPixmap( pix );
pixmap->setMask( mask );
return pixmap;
}
void AudioWidget::resizeEvent( QResizeEvent * ) {
int h = height();
int w = width();
songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) );
@@ -433,26 +432,25 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
emit moreClicked();
return;
case AudioVolumeDown:
emit lessClicked();
return;
case AudioForward:
emit forwardClicked();
return;
case AudioBack:
emit backClicked();
return;
}
- }
- else if ( !isOnButton && audioButtons[i].isHeld ) {
+ } else if ( !isOnButton && audioButtons[i].isHeld ) {
audioButtons[i].isHeld = FALSE;
toggleButton(i);
}
} else {
if ( audioButtons[i].isHeld ) {
audioButtons[i].isHeld = FALSE;
if ( !audioButtons[i].isToggle ) {
setToggleButton( i, FALSE );
}
switch (i) {
case AudioPlay:
if( mediaPlayerState->isPaused ) {
@@ -513,26 +511,25 @@ void AudioWidget::paintEvent( QPaintEvent * pe) {
p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
for ( int i = 0; i < numButtons; i++ )
paintButton( &p, i );
QPainter p2( this );
p2.drawPixmap( pe->rect().topLeft(), pix );
} else {
QPainter p( this );
for ( int i = 0; i < numButtons; i++ )
paintButton( &p, i );
}
}
-void AudioWidget::keyReleaseEvent( QKeyEvent *e)
-{
+void AudioWidget::keyReleaseEvent( QKeyEvent *e) {
switch ( e->key() ) {
////////////////////////////// Zaurus keys
case Key_Home:
break;
case Key_F9: //activity
hide();
// qDebug("Audio F9");
break;
case Key_F10: //contacts
break;
case Key_F11: //menu
mediaPlayerState->toggleBlank();