-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 47 |
1 files changed, 6 insertions, 41 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index de91a59..e21b0b1 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <qpe/qpeapplication.h> | 34 | #include <qpe/qpeapplication.h> |
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <opie/oticker.h> | ||
37 | 38 | ||
38 | #include <qwidget.h> | 39 | #include <qwidget.h> |
39 | #include <qpixmap.h> | 40 | #include <qpixmap.h> |
@@ -55,46 +56,6 @@ extern PlayListWidget *playList; | |||
55 | static const int xo = -2; // movable x offset | 56 | static const int xo = -2; // movable x offset |
56 | static const int yo = 22; // movable y offset | 57 | static const int yo = 22; // movable y offset |
57 | 58 | ||
58 | |||
59 | Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) { | ||
60 | setFrameStyle( WinPanel | Sunken ); | ||
61 | //setText( "No Song" ); | ||
62 | } | ||
63 | |||
64 | Ticker::~Ticker() { | ||
65 | } | ||
66 | |||
67 | void Ticker::setText( const QString& text ) { | ||
68 | pos = 0; // reset it everytime the text is changed | ||
69 | scrollText = text; | ||
70 | pixelLen = fontMetrics().width( scrollText ); | ||
71 | killTimers(); | ||
72 | if ( pixelLen > width() ) { | ||
73 | startTimer( 50 ); | ||
74 | } | ||
75 | update(); | ||
76 | } | ||
77 | |||
78 | |||
79 | void Ticker::timerEvent( QTimerEvent * ) { | ||
80 | pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; | ||
81 | scroll( -1, 0, contentsRect() ); | ||
82 | repaint( FALSE ); | ||
83 | } | ||
84 | |||
85 | void Ticker::drawContents( QPainter *p ) { | ||
86 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) { | ||
87 | p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | ||
88 | } | ||
89 | QPixmap pm( width(), height() ); | ||
90 | pm.fill( colorGroup().base() ); | ||
91 | QPainter pmp( &pm ); | ||
92 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) { | ||
93 | pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | ||
94 | } | ||
95 | p->drawPixmap( 0, 0, pm ); | ||
96 | } | ||
97 | |||
98 | struct MediaButton { | 59 | struct MediaButton { |
99 | bool isToggle, isHeld, isDown; | 60 | bool isToggle, isHeld, isDown; |
100 | }; | 61 | }; |
@@ -174,7 +135,11 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
174 | setBackgroundPixmap( *pixBg ); | 135 | setBackgroundPixmap( *pixBg ); |
175 | 136 | ||
176 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 137 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
177 | changeTextColor( &songInfo ); | 138 | // changeTextColor( &songInfo ); |
139 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | ||
140 | // songInfo.setFrameStyle( QFrame::NoFrame); | ||
141 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | ||
142 | // songInfo.setForegroundColor(Qt::white); | ||
178 | 143 | ||
179 | slider.setFixedHeight( 20 ); | 144 | slider.setFixedHeight( 20 ); |
180 | slider.setMinValue( 0 ); | 145 | slider.setMinValue( 0 ); |