summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/audiowidget.h
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/audiowidget.h') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h44
1 files changed, 7 insertions, 37 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index eab5df4..441eb6e 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -31,43 +31,13 @@ enum AudioButtons {
31class Ticker : public QFrame { 31class Ticker : public QFrame {
32 Q_OBJECT 32 Q_OBJECT
33
33public: 34public:
34 Ticker( QWidget* parent=0 ) : QFrame( parent ) { 35 Ticker( QWidget* parent=0 );
35 setFrameStyle( WinPanel | Sunken ); 36 ~Ticker();
36 setText( "No Song" ); 37 void setText( const QString& text ) ;
37 } 38
38 ~Ticker() { }
39 void setText( const QString& text ) {
40 pos = 0; // reset it everytime the text is changed
41 scrollText = text;
42 pixelLen = fontMetrics().width( scrollText );
43 killTimers();
44 if ( pixelLen > width() )
45 startTimer( 50 );
46 update();
47 }
48protected: 39protected:
49 void timerEvent( QTimerEvent * ) { 40 void timerEvent( QTimerEvent * );
50 pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; 41 void drawContents( QPainter *p );
51#ifndef USE_DBLBUF
52 scroll( -1, 0, contentsRect() );
53#else
54 repaint( FALSE );
55#endif
56 }
57 void drawContents( QPainter *p ) {
58#ifndef USE_DBLBUF
59 for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen )
60 p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText );
61#else
62 // Double buffering code.
63 // Looks like qvfb makes it look like it flickers but I don't think it really is
64 QPixmap pm( width(), height() );
65 pm.fill( colorGroup().base() );
66 QPainter pmp( &pm );
67 for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen )
68 pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText );
69 p->drawPixmap( 0, 0, pm );
70#endif
71 }
72private: 42private:
73 QString scrollText; 43 QString scrollText;