summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/audiowidget.h
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/audiowidget.h') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiowidget.h45
1 files changed, 23 insertions, 22 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.h b/core/multimedia/opieplayer/audiowidget.h
index 53e84b3..a2850aa 100644
--- a/core/multimedia/opieplayer/audiowidget.h
+++ b/core/multimedia/opieplayer/audiowidget.h
@@ -49,47 +49,47 @@ enum AudioButtons {
49 49
50 50
51class Ticker : public QFrame { 51class Ticker : public QFrame {
52 Q_OBJECT 52 Q_OBJECT
53public: 53public:
54 Ticker( QWidget* parent=0 ) : QFrame( parent ) { 54 Ticker( QWidget* parent=0 ) : QFrame( parent ) {
55 setFrameStyle( WinPanel | Sunken ); 55 setFrameStyle( WinPanel | Sunken );
56 setText( "No Song" ); 56 setText( "No Song" );
57 } 57 }
58 ~Ticker() { } 58 ~Ticker() { }
59 void setText( const QString& text ) { 59 void setText( const QString& text ) {
60 pos = 0; // reset it everytime the text is changed 60 pos = 0; // reset it everytime the text is changed
61 scrollText = text; 61 scrollText = text;
62 pixelLen = fontMetrics().width( scrollText ); 62 pixelLen = fontMetrics().width( scrollText );
63 killTimers(); 63 killTimers();
64 if ( pixelLen > width() ) 64 if ( pixelLen > width() )
65 startTimer( 50 ); 65 startTimer( 50 );
66 update(); 66 update();
67 } 67 }
68protected: 68protected:
69 void timerEvent( QTimerEvent * ) { 69 void timerEvent( QTimerEvent * ) {
70 pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; 70 pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1;
71#ifndef USE_DBLBUF 71#ifndef USE_DBLBUF
72 scroll( -1, 0, contentsRect() ); 72 scroll( -1, 0, contentsRect() );
73#else 73#else
74 repaint( FALSE ); 74 repaint( FALSE );
75#endif 75#endif
76 } 76 }
77 void drawContents( QPainter *p ) { 77 void drawContents( QPainter *p ) {
78#ifndef USE_DBLBUF 78#ifndef USE_DBLBUF
79 for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) 79 for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen )
80 p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); 80 p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText );
81#else 81#else
82 // Double buffering code. 82 // Double buffering code.
83 // Looks like qvfb makes it look like it flickers but I don't think it really is 83 // Looks like qvfb makes it look like it flickers but I don't think it really is
84 QPixmap pm( width(), height() ); 84 QPixmap pm( width(), height() );
85 pm.fill( colorGroup().base() ); 85 pm.fill( colorGroup().base() );
86 QPainter pmp( &pm ); 86 QPainter pmp( &pm );
87 for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) 87 for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen )
88 pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); 88 pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText );
89 p->drawPixmap( 0, 0, pm ); 89 p->drawPixmap( 0, 0, pm );
90#endif 90#endif
91 } 91 }
92private: 92private:
93 QString scrollText; 93 QString scrollText;
94 int pos, pixelLen; 94 int pos, pixelLen;
95}; 95};
@@ -125,12 +125,13 @@ protected:
125 void showEvent( QShowEvent *se ); 125 void showEvent( QShowEvent *se );
126 void mouseMoveEvent( QMouseEvent *event ); 126 void mouseMoveEvent( QMouseEvent *event );
127 void mousePressEvent( QMouseEvent *event ); 127 void mousePressEvent( QMouseEvent *event );
128 void mouseReleaseEvent( QMouseEvent *event ); 128 void mouseReleaseEvent( QMouseEvent *event );
129 void timerEvent( QTimerEvent *event ); 129 void timerEvent( QTimerEvent *event );
130 void closeEvent( QCloseEvent *event ); 130 void closeEvent( QCloseEvent *event );
131 void keyReleaseEvent( QKeyEvent *e);
131 132
132private: 133private:
133 void toggleButton( int ); 134 void toggleButton( int );
134 void setToggleButton( int, bool ); 135 void setToggleButton( int, bool );
135 void paintButton( QPainter *p, int i ); 136 void paintButton( QPainter *p, int i );
136 QPixmap *pixmaps[4]; 137 QPixmap *pixmaps[4];