author | llornkcor <llornkcor> | 2002-11-03 21:45:32 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-03 21:45:32 (UTC) |
commit | bf62b8f48d08f5a5e92681e1487a5f43d5c7a231 (patch) (unidiff) | |
tree | f2a02844f411d874e9afd703c18b6ebd70d97172 /core/multimedia/opieplayer/audiowidget.h | |
parent | 5ba841a12e67b326833751ea502cf054e423114d (diff) | |
download | opie-bf62b8f48d08f5a5e92681e1487a5f43d5c7a231.zip opie-bf62b8f48d08f5a5e92681e1487a5f43d5c7a231.tar.gz opie-bf62b8f48d08f5a5e92681e1487a5f43d5c7a231.tar.bz2 |
m3u stuff and op2 skins
Diffstat (limited to 'core/multimedia/opieplayer/audiowidget.h') (more/less context) (ignore 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 | |||
@@ -24,16 +24,18 @@ | |||
24 | #include <qwidget.h> | 24 | #include <qwidget.h> |
25 | #include <qpainter.h> | 25 | #include <qpainter.h> |
26 | #include <qdrawutil.h> | 26 | #include <qdrawutil.h> |
27 | #include <qpixmap.h> | 27 | #include <qpixmap.h> |
28 | #include <qbitmap.h> | ||
28 | #include <qstring.h> | 29 | #include <qstring.h> |
29 | #include <qslider.h> | 30 | #include <qslider.h> |
31 | #include <qlineedit.h> | ||
30 | #include <qframe.h> | 32 | #include <qframe.h> |
31 | 33 | ||
34 | #include <opie/oticker.h> | ||
32 | 35 | ||
33 | class QPixmap; | 36 | class QPixmap; |
34 | 37 | ||
35 | |||
36 | enum AudioButtons { | 38 | enum AudioButtons { |
37 | AudioPlay, | 39 | AudioPlay, |
38 | AudioStop, | 40 | AudioStop, |
39 | AudioPause, | 41 | AudioPause, |
@@ -45,64 +47,16 @@ enum AudioButtons { | |||
45 | AudioPlayList | 47 | AudioPlayList |
46 | }; | 48 | }; |
47 | 49 | ||
48 | 50 | ||
49 | #define USE_DBLBUF | 51 | //#define USE_DBLBUF |
50 | |||
51 | |||
52 | class Ticker : public QFrame { | ||
53 | Q_OBJECT | ||
54 | public: | ||
55 | Ticker( QWidget* parent=0 ) : QFrame( parent ) { | ||
56 | setFrameStyle( WinPanel | Sunken ); | ||
57 | setText( "No Song" ); | ||
58 | } | ||
59 | ~Ticker() { } | ||
60 | void setText( const QString& text ) { | ||
61 | pos = 0; // reset it everytime the text is changed | ||
62 | scrollText = text; | ||
63 | pixelLen = fontMetrics().width( scrollText ); | ||
64 | killTimers(); | ||
65 | if ( pixelLen > width() ) | ||
66 | startTimer( 50 ); | ||
67 | update(); | ||
68 | } | ||
69 | protected: | ||
70 | void timerEvent( QTimerEvent * ) { | ||
71 | pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; | ||
72 | #ifndef USE_DBLBUF | ||
73 | scroll( -1, 0, contentsRect() ); | ||
74 | #else | ||
75 | repaint( FALSE ); | ||
76 | #endif | ||
77 | } | ||
78 | void drawContents( QPainter *p ) { | ||
79 | #ifndef USE_DBLBUF | ||
80 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) | ||
81 | p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | ||
82 | #else | ||
83 | // Double buffering code. | ||
84 | // Looks like qvfb makes it look like it flickers but I don't think it really is | ||
85 | QPixmap pm( width(), height() ); | ||
86 | pm.fill( colorGroup().base() ); | ||
87 | QPainter pmp( &pm ); | ||
88 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) | ||
89 | pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | ||
90 | p->drawPixmap( 0, 0, pm ); | ||
91 | #endif | ||
92 | } | ||
93 | private: | ||
94 | QString scrollText; | ||
95 | int pos, pixelLen; | ||
96 | }; | ||
97 | |||
98 | 52 | ||
99 | class AudioWidget : public QWidget { | 53 | class AudioWidget : public QWidget { |
100 | Q_OBJECT | 54 | Q_OBJECT |
101 | public: | 55 | public: |
102 | AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 56 | AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
103 | ~AudioWidget(); | 57 | ~AudioWidget(); |
104 | void setTickerText( const QString &text ) { songInfo->setText( text ); } | 58 | void setTickerText( const QString &text ) { songInfo.setText( text ); } |
105 | bool isStreaming; | 59 | bool isStreaming; |
106 | public slots: | 60 | public slots: |
107 | void updateSlider( long, long ); | 61 | void updateSlider( long, long ); |
108 | void sliderPressed( ); | 62 | void sliderPressed( ); |
@@ -125,8 +79,9 @@ protected: | |||
125 | void doBlank(); | 79 | void doBlank(); |
126 | void doUnblank(); | 80 | void doUnblank(); |
127 | void paintEvent( QPaintEvent *pe ); | 81 | void paintEvent( QPaintEvent *pe ); |
128 | void showEvent( QShowEvent *se ); | 82 | void showEvent( QShowEvent *se ); |
83 | void resizeEvent( QResizeEvent *re ); | ||
129 | void mouseMoveEvent( QMouseEvent *event ); | 84 | void mouseMoveEvent( QMouseEvent *event ); |
130 | void mousePressEvent( QMouseEvent *event ); | 85 | void mousePressEvent( QMouseEvent *event ); |
131 | void mouseReleaseEvent( QMouseEvent *event ); | 86 | void mouseReleaseEvent( QMouseEvent *event ); |
132 | void timerEvent( QTimerEvent *event ); | 87 | void timerEvent( QTimerEvent *event ); |
@@ -135,11 +90,23 @@ protected: | |||
135 | private: | 90 | private: |
136 | void toggleButton( int ); | 91 | void toggleButton( int ); |
137 | void setToggleButton( int, bool ); | 92 | void setToggleButton( int, bool ); |
138 | void paintButton( QPainter *p, int i ); | 93 | void paintButton( QPainter *p, int i ); |
94 | QString skin; | ||
95 | QPixmap *pixBg; | ||
96 | QImage *imgUp; | ||
97 | QImage *imgDn; | ||
98 | QImage *imgButtonMask; | ||
99 | QBitmap *masks[11]; | ||
100 | QPixmap *buttonPixUp[11]; | ||
101 | QPixmap *buttonPixDown[11]; | ||
102 | |||
139 | QPixmap *pixmaps[4]; | 103 | QPixmap *pixmaps[4]; |
140 | Ticker *songInfo; | 104 | OTicker songInfo; |
141 | QSlider *slider; | 105 | QSlider slider; |
106 | QLineEdit time; | ||
107 | int xoff, yoff; | ||
108 | |||
142 | }; | 109 | }; |
143 | 110 | ||
144 | 111 | ||
145 | #endif // AUDIO_WIDGET_H | 112 | #endif // AUDIO_WIDGET_H |