Diffstat (limited to 'core/multimedia/opieplayer/audiowidget.h') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.h | 73 |
1 files changed, 20 insertions, 53 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.h b/core/multimedia/opieplayer/audiowidget.h index b3d39bf..c686741 100644 --- a/core/multimedia/opieplayer/audiowidget.h +++ b/core/multimedia/opieplayer/audiowidget.h @@ -25,14 +25,16 @@ #include <qpainter.h> #include <qdrawutil.h> #include <qpixmap.h> +#include <qbitmap.h> #include <qstring.h> #include <qslider.h> +#include <qlineedit.h> #include <qframe.h> +#include <opie/oticker.h> class QPixmap; - enum AudioButtons { AudioPlay, AudioStop, @@ -46,62 +48,14 @@ enum AudioButtons { }; -#define USE_DBLBUF - - -class Ticker : public QFrame { - Q_OBJECT -public: - Ticker( QWidget* parent=0 ) : QFrame( parent ) { - setFrameStyle( WinPanel | Sunken ); - setText( "No Song" ); - } - ~Ticker() { } - void setText( const QString& text ) { - pos = 0; // reset it everytime the text is changed - scrollText = text; - pixelLen = fontMetrics().width( scrollText ); - killTimers(); - if ( pixelLen > width() ) - startTimer( 50 ); - update(); - } -protected: - void timerEvent( QTimerEvent * ) { - pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; -#ifndef USE_DBLBUF - scroll( -1, 0, contentsRect() ); -#else - repaint( FALSE ); -#endif - } - void drawContents( QPainter *p ) { -#ifndef USE_DBLBUF - for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) - p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); -#else - // Double buffering code. - // Looks like qvfb makes it look like it flickers but I don't think it really is - 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 ); -#endif - } -private: - QString scrollText; - int pos, pixelLen; -}; - +//#define USE_DBLBUF class AudioWidget : public QWidget { Q_OBJECT public: AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); ~AudioWidget(); - void setTickerText( const QString &text ) { songInfo->setText( text ); } + void setTickerText( const QString &text ) { songInfo.setText( text ); } bool isStreaming; public slots: void updateSlider( long, long ); @@ -126,6 +80,7 @@ protected: void doUnblank(); void paintEvent( QPaintEvent *pe ); void showEvent( QShowEvent *se ); + void resizeEvent( QResizeEvent *re ); void mouseMoveEvent( QMouseEvent *event ); void mousePressEvent( QMouseEvent *event ); void mouseReleaseEvent( QMouseEvent *event ); @@ -136,9 +91,21 @@ private: void toggleButton( int ); void setToggleButton( int, bool ); void paintButton( QPainter *p, int i ); + QString skin; + QPixmap *pixBg; + QImage *imgUp; + QImage *imgDn; + QImage *imgButtonMask; + QBitmap *masks[11]; + QPixmap *buttonPixUp[11]; + QPixmap *buttonPixDown[11]; + QPixmap *pixmaps[4]; - Ticker *songInfo; - QSlider *slider; + OTicker songInfo; + QSlider slider; + QLineEdit time; + int xoff, yoff; + }; |