summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp31
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h6
2 files changed, 23 insertions, 14 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 2cb1385..cc6187c 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -1,568 +1,577 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
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 37
38#include <qwidget.h> 38#include <qwidget.h>
39#include <qpixmap.h> 39#include <qpixmap.h>
40#include <qbutton.h> 40#include <qbutton.h>
41#include <qpainter.h> 41#include <qpainter.h>
42#include <qframe.h> 42#include <qframe.h>
43#include <qlayout.h> 43#include <qlayout.h>
44 44
45#include <stdlib.h> 45#include <stdlib.h>
46#include <stdio.h> 46#include <stdio.h>
47 47
48#include "audiowidget.h" 48#include "audiowidget.h"
49#include "mediaplayerstate.h" 49#include "mediaplayerstate.h"
50 50
51extern MediaPlayerState *mediaPlayerState; 51extern MediaPlayerState *mediaPlayerState;
52 52
53static const int xo = -2; // movable x offset 53static const int xo = -2; // movable x offset
54static const int yo = 22; // movable y offset 54static const int yo = 22; // movable y offset
55 55
56 56
57Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) { 57Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) {
58 setFrameStyle( WinPanel | Sunken ); 58 setFrameStyle( WinPanel | Sunken );
59 setText( "No Song" ); 59 setText( "No Song" );
60} 60}
61 61
62Ticker::~Ticker() { 62Ticker::~Ticker() {
63} 63}
64 64
65void Ticker::setText( const QString& text ) { 65void Ticker::setText( const QString& text ) {
66 pos = 0; // reset it everytime the text is changed 66 pos = 0; // reset it everytime the text is changed
67 scrollText = text; 67 scrollText = text;
68 pixelLen = fontMetrics().width( scrollText ); 68 pixelLen = fontMetrics().width( scrollText );
69 killTimers(); 69 killTimers();
70 if ( pixelLen > width() ) { 70 if ( pixelLen > width() ) {
71 startTimer( 50 ); 71 startTimer( 50 );
72 } 72 }
73 update(); 73 update();
74} 74}
75 75
76 76
77void Ticker::timerEvent( QTimerEvent * ) { 77void Ticker::timerEvent( QTimerEvent * ) {
78 pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; 78 pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1;
79 scroll( -1, 0, contentsRect() ); 79 scroll( -1, 0, contentsRect() );
80 repaint( FALSE ); 80 repaint( FALSE );
81} 81}
82 82
83void Ticker::drawContents( QPainter *p ) { 83void Ticker::drawContents( QPainter *p ) {
84 for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) 84 for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen )
85 p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); 85 p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText );
86 QPixmap pm( width(), height() ); 86 QPixmap pm( width(), height() );
87 pm.fill( colorGroup().base() ); 87 pm.fill( colorGroup().base() );
88 QPainter pmp( &pm ); 88 QPainter pmp( &pm );
89 for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) { 89 for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) {
90 pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); 90 pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText );
91 } 91 }
92 p->drawPixmap( 0, 0, pm ); 92 p->drawPixmap( 0, 0, pm );
93} 93}
94 94
95struct MediaButton { 95struct MediaButton {
96 bool isToggle, isHeld, isDown; 96 bool isToggle, isHeld, isDown;
97}; 97};
98 98
99//Layout information for the audioButtons (and if it is a toggle button or not) 99//Layout information for the audioButtons (and if it is a toggle button or not)
100MediaButton audioButtons[] = { 100MediaButton audioButtons[] = {
101 { TRUE, FALSE, FALSE }, // play 101 { TRUE, FALSE, FALSE }, // play
102 { FALSE, FALSE, FALSE }, // stop 102 { FALSE, FALSE, FALSE }, // stop
103 { FALSE, FALSE, FALSE }, // pause
104 { FALSE, FALSE, FALSE }, // next 103 { FALSE, FALSE, FALSE }, // next
105 { FALSE, FALSE, FALSE }, // previous 104 { FALSE, FALSE, FALSE }, // previous
106 { FALSE, FALSE, FALSE }, // volume up 105 { FALSE, FALSE, FALSE }, // volume up
107 { FALSE, FALSE, FALSE }, // volume down 106 { FALSE, FALSE, FALSE }, // volume down
108 { TRUE, FALSE, FALSE }, // repeat/loop 107 { TRUE, FALSE, FALSE }, // repeat/loop
109 { FALSE, FALSE, FALSE }, // playlist 108 { FALSE, FALSE, FALSE }, // playlist
110 { FALSE, FALSE, FALSE }, // forward 109 { FALSE, FALSE, FALSE }, // forward
111 { FALSE, FALSE, FALSE } // back 110 { FALSE, FALSE, FALSE } // back
112}; 111};
113 112
114const char *skin_mask_file_names[11] = { 113const char *skin_mask_file_names[10] = {
115 "play", "stop", "pause", "next", "prev", "up", 114 "play", "stop", "next", "prev", "up",
116 "down", "loop", "playlist", "forward", "back" 115 "down", "loop", "playlist", "forward", "back"
117}; 116};
118 117
119 118
120static void changeTextColor( QWidget *w ) { 119static void changeTextColor( QWidget *w ) {
121 QPalette p = w->palette(); 120 QPalette p = w->palette();
122 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); 121 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
123 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); 122 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
124 w->setPalette( p ); 123 w->setPalette( p );
125} 124}
126 125
127static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); 126static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
128 127
129 128
130AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : 129AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
131 QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { 130 QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) {
132 setCaption( tr("OpiePlayer") ); 131 setCaption( tr("OpiePlayer") );
133 132
134 Config cfg("OpiePlayer"); 133 Config cfg("OpiePlayer");
135 cfg.setGroup("Options"); 134 cfg.setGroup("Options");
136 skin = cfg.readEntry("Skin","default"); 135 skin = cfg.readEntry("Skin","default");
137 //skin = "scaleTest"; 136 //skin = "scaleTest";
138// color of background, frame, degree of transparency 137// color of background, frame, degree of transparency
139 138
140 QString skinPath = "opieplayer2/skins/" + skin; 139 QString skinPath = "opieplayer2/skins/" + skin;
141 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 140 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
142 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 141 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
143 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 142 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
144 143
145 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); 144 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
146 imgButtonMask->fill( 0 ); 145 imgButtonMask->fill( 0 );
147 146
148 for ( int i = 0; i < 11; i++ ) { 147 for ( int i = 0; i < 10; i++ ) {
149 QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; 148 QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png";
150 masks[i] = new QBitmap( filename ); 149 masks[i] = new QBitmap( filename );
151 150
152 if ( !masks[i]->isNull() ) { 151 if ( !masks[i]->isNull() ) {
153 QImage imgMask = masks[i]->convertToImage(); 152 QImage imgMask = masks[i]->convertToImage();
154 uchar **dest = imgButtonMask->jumpTable(); 153 uchar **dest = imgButtonMask->jumpTable();
155 for ( int y = 0; y < imgUp->height(); y++ ) { 154 for ( int y = 0; y < imgUp->height(); y++ ) {
156 uchar *line = dest[y]; 155 uchar *line = dest[y];
157 for ( int x = 0; x < imgUp->width(); x++ ) 156 for ( int x = 0; x < imgUp->width(); x++ )
158 if ( !qRed( imgMask.pixel( x, y ) ) ) 157 if ( !qRed( imgMask.pixel( x, y ) ) )
159 line[x] = i + 1; 158 line[x] = i + 1;
160 } 159 }
161 } 160 }
162 161
163 } 162 }
164 163
165 for ( int i = 0; i < 11; i++ ) { 164 for ( int i = 0; i < 10; i++ ) {
166 buttonPixUp[i] = NULL; 165 buttonPixUp[i] = NULL;
167 buttonPixDown[i] = NULL; 166 buttonPixDown[i] = NULL;
168 } 167 }
169 168
170 setBackgroundPixmap( *pixBg ); 169 setBackgroundPixmap( *pixBg );
171 170
172 songInfo.setFocusPolicy( QWidget::NoFocus ); 171 songInfo.setFocusPolicy( QWidget::NoFocus );
173 changeTextColor( &songInfo ); 172 changeTextColor( &songInfo );
174 173
175 slider.setFixedHeight( 20 ); 174 slider.setFixedHeight( 20 );
176 slider.setMinValue( 0 ); 175 slider.setMinValue( 0 );
177 slider.setMaxValue( 1 ); 176 slider.setMaxValue( 1 );
178 slider.setFocusPolicy( QWidget::NoFocus ); 177 slider.setFocusPolicy( QWidget::NoFocus );
179 slider.setBackgroundPixmap( *pixBg ); 178 slider.setBackgroundPixmap( *pixBg );
180 179
181 time.setFocusPolicy( QWidget::NoFocus ); 180 time.setFocusPolicy( QWidget::NoFocus );
182 time.setAlignment( Qt::AlignCenter ); 181 time.setAlignment( Qt::AlignCenter );
183 time.setFrame(FALSE); 182 time.setFrame(FALSE);
184 changeTextColor( &time ); 183 changeTextColor( &time );
185 184
186 resizeEvent( NULL ); 185 resizeEvent( NULL );
187 186
188 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 187 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
189 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 188 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
190 189
191 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 190 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
192 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 191 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
193 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 192 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
194 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); 193 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
195 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 194 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
196 195
197 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); 196 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) );
198 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); 197 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) );
199 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); 198 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) );
200 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); 199 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) );
201 200
202 201
203 202
204 // Intialise state 203 // Intialise state
205 setLength( mediaPlayerState->length() ); 204 setLength( mediaPlayerState->length() );
206 setPosition( mediaPlayerState->position() ); 205 setPosition( mediaPlayerState->position() );
207 setLooping( mediaPlayerState->fullscreen() ); 206 setLooping( mediaPlayerState->fullscreen() );
208 setPaused( mediaPlayerState->paused() ); 207 setPaused( mediaPlayerState->paused() );
209 setPlaying( mediaPlayerState->playing() ); 208 setPlaying( mediaPlayerState->playing() );
210 209
211} 210}
212 211
213AudioWidget::~AudioWidget() { 212AudioWidget::~AudioWidget() {
214 213
215 for ( int i = 0; i < 11; i++ ) { 214 for ( int i = 0; i < 10; i++ ) {
216 delete buttonPixUp[i]; 215 delete buttonPixUp[i];
217 delete buttonPixDown[i]; 216 delete buttonPixDown[i];
218 } 217 }
219 delete pixBg; 218 delete pixBg;
220 delete imgUp; 219 delete imgUp;
221 delete imgDn; 220 delete imgDn;
222 delete imgButtonMask; 221 delete imgButtonMask;
223 for ( int i = 0; i < 11; i++ ) { 222 for ( int i = 0; i < 10; i++ ) {
224 delete masks[i]; 223 delete masks[i];
225 } 224 }
226} 225}
227 226
228QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 227QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
229 QPixmap pix( img.width(), img.height() ); 228 QPixmap pix( img.width(), img.height() );
230 QPainter p( &pix ); 229 QPainter p( &pix );
231 p.drawTiledPixmap( pix.rect(), bg, offset ); 230 p.drawTiledPixmap( pix.rect(), bg, offset );
232 p.drawImage( 0, 0, img ); 231 p.drawImage( 0, 0, img );
233 return new QPixmap( pix ); 232 return new QPixmap( pix );
234} 233}
235 234
236 235
237QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) 236QPixmap *maskPixToMask( QPixmap pix, QBitmap mask )
238{ 237{
239 QPixmap *pixmap = new QPixmap( pix ); 238 QPixmap *pixmap = new QPixmap( pix );
240 pixmap->setMask( mask ); 239 pixmap->setMask( mask );
241 return pixmap; 240 return pixmap;
242} 241}
243 242
244 243
245 244
246void AudioWidget::resizeEvent( QResizeEvent * ) { 245void AudioWidget::resizeEvent( QResizeEvent * ) {
247 int h = height(); 246 int h = height();
248 int w = width(); 247 int w = width();
249 248
250 songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); 249 songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) );
251 slider.setFixedWidth( w - 110 ); 250 slider.setFixedWidth( w - 110 );
252 slider.setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); 251 slider.setGeometry( QRect( 15, h - 30, w - 90, 20 ) );
253 slider.setBackgroundOrigin( QWidget::ParentOrigin ); 252 slider.setBackgroundOrigin( QWidget::ParentOrigin );
254 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); 253 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
255 254
256 xoff = ( w - imgUp->width() ) / 2; 255 xoff = ( w - imgUp->width() ) / 2;
257 yoff = (( h - imgUp->height() ) / 2) - 10; 256 yoff = (( h - imgUp->height() ) / 2) - 10;
258 QPoint p( xoff, yoff ); 257 QPoint p( xoff, yoff );
259 258
260 QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p ); 259 QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p );
261 QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p ); 260 QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p );
262 261
263 for ( int i = 0; i < 11; i++ ) { 262 for ( int i = 0; i < 10; i++ ) {
264 if ( !masks[i]->isNull() ) { 263 if ( !masks[i]->isNull() ) {
265 delete buttonPixUp[i]; 264 delete buttonPixUp[i];
266 delete buttonPixDown[i]; 265 delete buttonPixDown[i];
267 buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] ); 266 buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] );
268 buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] ); 267 buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] );
269 } 268 }
270 } 269 }
271 270
272 delete pixUp; 271 delete pixUp;
273 delete pixDn; 272 delete pixDn;
274} 273}
275 274
276static bool audioSliderBeingMoved = FALSE; 275static bool audioSliderBeingMoved = FALSE;
277 276
278 277
279void AudioWidget::sliderPressed() { 278void AudioWidget::sliderPressed() {
280 audioSliderBeingMoved = TRUE; 279 audioSliderBeingMoved = TRUE;
281} 280}
282 281
283 282
284void AudioWidget::sliderReleased() { 283void AudioWidget::sliderReleased() {
285 audioSliderBeingMoved = FALSE; 284 audioSliderBeingMoved = FALSE;
286 if ( slider.width() == 0 ) 285 if ( slider.width() == 0 )
287 return; 286 return;
288 long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); 287 long val = long((double)slider.value() * mediaPlayerState->length() / slider.width());
289 mediaPlayerState->setPosition( val ); 288 mediaPlayerState->setPosition( val );
290} 289}
291 290
292void AudioWidget::setPosition( long i ) { 291void AudioWidget::setPosition( long i ) {
293// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 292// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
294 updateSlider( i, mediaPlayerState->length() ); 293 updateSlider( i, mediaPlayerState->length() );
295} 294}
296 295
297 296
298void AudioWidget::setLength( long max ) { 297void AudioWidget::setLength( long max ) {
299 updateSlider( mediaPlayerState->position(), max ); 298 updateSlider( mediaPlayerState->position(), max );
300} 299}
301 300
302 301
303void AudioWidget::setView( char view ) { 302void AudioWidget::setView( char view ) {
304 303
305// this isnt working for some reason 304// this isnt working for some reason
306 305
307 if ( mediaPlayerState->streaming() ) { 306 if ( mediaPlayerState->streaming() ) {
308 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); 307 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
309 if( !slider.isHidden()) { 308 if( !slider.isHidden()) {
310 slider.hide(); 309 slider.hide();
311 } 310 }
312 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 311 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
313 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 312 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
314 } else { 313 } else {
315 // this stops the slider from being moved, thus 314 // this stops the slider from being moved, thus
316 // does not stop stream when it reaches the end 315 // does not stop stream when it reaches the end
317 slider.show(); 316 slider.show();
318 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 317 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
319 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 318 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
320 } 319 }
321 320
322 if ( view == 'a' ) { 321 if ( view == 'a' ) {
323 // startTimer( 150 ); 322 // startTimer( 150 );
324 showMaximized(); 323 showMaximized();
325 } else { 324 } else {
326 killTimers(); 325 killTimers();
327 hide(); 326 hide();
328 } 327 }
329} 328}
330 329
331 330
332static QString timeAsString( long length ) { 331static QString timeAsString( long length ) {
333 int minutes = length / 60; 332 int minutes = length / 60;
334 int seconds = length % 60; 333 int seconds = length % 60;
335 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); 334 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 );
336} 335}
337 336
338void AudioWidget::updateSlider( long i, long max ) { 337void AudioWidget::updateSlider( long i, long max ) {
339 338
340 time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); 339 time.setText( timeAsString( i ) + " / " + timeAsString( max ) );
341// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; 340// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ;
342 341
343 if ( max == 0 ) { 342 if ( max == 0 ) {
344 return; 343 return;
345 } 344 }
346 // Will flicker too much if we don't do this 345 // Will flicker too much if we don't do this
347 // Scale to something reasonable 346 // Scale to something reasonable
348 int width = slider.width(); 347 int width = slider.width();
349 int val = int((double)i * width / max); 348 int val = int((double)i * width / max);
350 if ( !audioSliderBeingMoved ) { 349 if ( !audioSliderBeingMoved ) {
351 if ( slider.value() != val ) { 350 if ( slider.value() != val ) {
352 slider.setValue( val ); 351 slider.setValue( val );
353 } 352 }
354 353
355 if ( slider.maxValue() != width ) { 354 if ( slider.maxValue() != width ) {
356 slider.setMaxValue( width ); 355 slider.setMaxValue( width );
357 } 356 }
358 } 357 }
359} 358}
360 359
361 360
362void AudioWidget::setToggleButton( int i, bool down ) { 361void AudioWidget::setToggleButton( int i, bool down ) {
363 if ( down != audioButtons[i].isDown ) { 362 if ( down != audioButtons[i].isDown ) {
364 toggleButton( i ); 363 toggleButton( i );
365 } 364 }
366} 365}
367 366
368 367
369void AudioWidget::toggleButton( int i ) { 368void AudioWidget::toggleButton( int i ) {
370 audioButtons[i].isDown = !audioButtons[i].isDown; 369 audioButtons[i].isDown = !audioButtons[i].isDown;
371 QPainter p(this); 370 QPainter p(this);
372 paintButton ( &p, i ); 371 paintButton ( &p, i );
373} 372}
374 373
375 374
376void AudioWidget::paintButton( QPainter *p, int i ) { 375void AudioWidget::paintButton( QPainter *p, int i ) {
377 if ( audioButtons[i].isDown ) { 376 if ( audioButtons[i].isDown ) {
378 p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); 377 p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
379 } else { 378 } else {
380 p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); 379 p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
381 } 380 }
382} 381}
383 382
384 383
385void AudioWidget::skipFor() { 384void AudioWidget::skipFor() {
386 skipDirection = +1; 385 skipDirection = +1;
387 startTimer( 50 ); 386 startTimer( 50 );
388 mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); 387 mediaPlayerState->setPosition( mediaPlayerState->position() + 2 );
389} 388}
390 389
391void AudioWidget::skipBack() { 390void AudioWidget::skipBack() {
392 skipDirection = -1; 391 skipDirection = -1;
393 startTimer( 50 ); 392 startTimer( 50 );
394 mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); 393 mediaPlayerState->setPosition( mediaPlayerState->position() - 2 );
395} 394}
396 395
397 396
398 397
399void AudioWidget::stopSkip() { 398void AudioWidget::stopSkip() {
400 killTimers(); 399 killTimers();
401} 400}
402 401
403 402
404void AudioWidget::timerEvent( QTimerEvent * ) { 403void AudioWidget::timerEvent( QTimerEvent * ) {
405 if ( skipDirection == +1 ) { 404 if ( skipDirection == +1 ) {
406 mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); 405 mediaPlayerState->setPosition( mediaPlayerState->position() + 2 );
407 } else if ( skipDirection == -1 ) { 406 } else if ( skipDirection == -1 ) {
408 mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); 407 mediaPlayerState->setPosition( mediaPlayerState->position() - 2 );
409 } 408 }
410} 409}
411 410
412 411
413void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { 412void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
414 for ( int i = 0; i < numButtons; i++ ) { 413 for ( int i = 0; i < numButtons; i++ ) {
415 if ( event->state() == QMouseEvent::LeftButton ) { 414 if ( event->state() == QMouseEvent::LeftButton ) {
416 // The test to see if the mouse click is inside the button or not 415 // The test to see if the mouse click is inside the button or not
417 int x = event->pos().x() - xoff; 416 int x = event->pos().x() - xoff;
418 int y = event->pos().y() - yoff; 417 int y = event->pos().y() - yoff;
419 418
420 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() 419 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
421 && y < imgButtonMask->height() 420 && y < imgButtonMask->height()
422 && imgButtonMask->pixelIndex( x, y ) == i + 1 ); 421 && imgButtonMask->pixelIndex( x, y ) == i + 1 );
423 422
424 if ( isOnButton && !audioButtons[i].isHeld ) { 423 if ( isOnButton && !audioButtons[i].isHeld ) {
425 audioButtons[i].isHeld = TRUE; 424 audioButtons[i].isHeld = TRUE;
426 toggleButton(i); 425 toggleButton(i);
427 426
428 switch (i) { 427 switch (i) {
429 case AudioVolumeUp: 428 case AudioVolumeUp:
430 qDebug("more clicked");
431 emit moreClicked(); 429 emit moreClicked();
432 return; 430 return;
433 case AudioVolumeDown: 431 case AudioVolumeDown:
434 emit lessClicked(); 432 emit lessClicked();
435 return; 433 return;
436 case AudioForward: 434 case AudioForward:
437 emit forwardClicked(); 435 emit forwardClicked();
438 return; 436 return;
439 case AudioBack: 437 case AudioBack:
440 emit backClicked(); 438 emit backClicked();
441 return; 439 return;
442 } 440 }
443 } else if ( !isOnButton && audioButtons[i].isHeld ) { 441 } else if ( !isOnButton && audioButtons[i].isHeld ) {
444 audioButtons[i].isHeld = FALSE; 442 audioButtons[i].isHeld = FALSE;
445 toggleButton(i); 443 toggleButton(i);
446 } 444 }
447 } else { 445 } else {
448 if ( audioButtons[i].isHeld ) { 446 if ( audioButtons[i].isHeld ) {
449 audioButtons[i].isHeld = FALSE; 447 audioButtons[i].isHeld = FALSE;
450 if ( !audioButtons[i].isToggle ) { 448 if ( !audioButtons[i].isToggle ) {
451 setToggleButton( i, FALSE ); 449 setToggleButton( i, FALSE );
452 qDebug("button toggled3 %d",i); 450 qDebug("button toggled3 %d",i);
453 } 451 }
454 switch (i) { 452 switch (i) {
455 case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; 453 case AudioPlay:
454 if( mediaPlayerState->isPaused ) {
455 setToggleButton( i, FALSE );
456 mediaPlayerState->setPaused( FALSE );
457 return;
458 } else if( !mediaPlayerState->isPaused ) {
459 setToggleButton( i, TRUE );
460 mediaPlayerState->setPaused( TRUE );
461 return;
462 } else {
463 // setToggleButton( i, TRUE );
464 // mediaPlayerState->setPlaying( videoButtons[i].isDown );
465 }
456 case AudioStop: mediaPlayerState->setPlaying(FALSE); return; 466 case AudioStop: mediaPlayerState->setPlaying(FALSE); return;
457 case AudioPause: mediaPlayerState->setPaused( audioButtons[i].isDown); return;
458 case AudioNext: mediaPlayerState->setNext(); return; 467 case AudioNext: mediaPlayerState->setNext(); return;
459 case AudioPrevious: mediaPlayerState->setPrev(); return; 468 case AudioPrevious: mediaPlayerState->setPrev(); return;
460 case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; 469 case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return;
461 case AudioVolumeUp: emit moreReleased(); return; 470 case AudioVolumeUp: emit moreReleased(); return;
462 case AudioVolumeDown: emit lessReleased(); return; 471 case AudioVolumeDown: emit lessReleased(); return;
463 case AudioPlayList: mediaPlayerState->setList(); return; 472 case AudioPlayList: mediaPlayerState->setList(); return;
464 case AudioForward: emit forwardReleased(); return; 473 case AudioForward: emit forwardReleased(); return;
465 case AudioBack: emit backReleased(); return; 474 case AudioBack: emit backReleased(); return;
466 } 475 }
467 } 476 }
468 } 477 }
469 } 478 }
470} 479}
471 480
472 481
473void AudioWidget::mousePressEvent( QMouseEvent *event ) { 482void AudioWidget::mousePressEvent( QMouseEvent *event ) {
474 mouseMoveEvent( event ); 483 mouseMoveEvent( event );
475} 484}
476 485
477 486
478void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { 487void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) {
479 mouseMoveEvent( event ); 488 mouseMoveEvent( event );
480} 489}
481 490
482 491
483void AudioWidget::showEvent( QShowEvent* ) { 492void AudioWidget::showEvent( QShowEvent* ) {
484 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 493 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
485 mouseMoveEvent( &event ); 494 mouseMoveEvent( &event );
486} 495}
487 496
488 497
489void AudioWidget::closeEvent( QCloseEvent* ) { 498void AudioWidget::closeEvent( QCloseEvent* ) {
490 mediaPlayerState->setList(); 499 mediaPlayerState->setList();
491} 500}
492 501
493 502
494void AudioWidget::paintEvent( QPaintEvent * pe) { 503void AudioWidget::paintEvent( QPaintEvent * pe) {
495 if ( !pe->erased() ) { 504 if ( !pe->erased() ) {
496 // Combine with background and double buffer 505 // Combine with background and double buffer
497 QPixmap pix( pe->rect().size() ); 506 QPixmap pix( pe->rect().size() );
498 QPainter p( &pix ); 507 QPainter p( &pix );
499 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 508 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
500 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); 509 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
501 for ( int i = 0; i < numButtons; i++ ) 510 for ( int i = 0; i < numButtons; i++ )
502 paintButton( &p, i ); 511 paintButton( &p, i );
503 QPainter p2( this ); 512 QPainter p2( this );
504 p2.drawPixmap( pe->rect().topLeft(), pix ); 513 p2.drawPixmap( pe->rect().topLeft(), pix );
505 } else { 514 } else {
506 QPainter p( this ); 515 QPainter p( this );
507 for ( int i = 0; i < numButtons; i++ ) 516 for ( int i = 0; i < numButtons; i++ )
508 paintButton( &p, i ); 517 paintButton( &p, i );
509 } 518 }
510} 519}
511 520
512void AudioWidget::keyReleaseEvent( QKeyEvent *e) 521void AudioWidget::keyReleaseEvent( QKeyEvent *e)
513{ 522{
514 switch ( e->key() ) { 523 switch ( e->key() ) {
515////////////////////////////// Zaurus keys 524////////////////////////////// Zaurus keys
516 case Key_Home: 525 case Key_Home:
517 break; 526 break;
518 case Key_F9: //activity 527 case Key_F9: //activity
519 hide(); 528 hide();
520// qDebug("Audio F9"); 529// qDebug("Audio F9");
521 break; 530 break;
522 case Key_F10: //contacts 531 case Key_F10: //contacts
523 break; 532 break;
524 case Key_F11: //menu 533 case Key_F11: //menu
525 break; 534 break;
526 case Key_F12: //home 535 case Key_F12: //home
527 break; 536 break;
528 case Key_F13: //mail 537 case Key_F13: //mail
529 break; 538 break;
530 case Key_Space: { 539 case Key_Space: {
531 if(mediaPlayerState->playing()) { 540 if(mediaPlayerState->playing()) {
532// toggleButton(1); 541// toggleButton(1);
533 mediaPlayerState->setPlaying(FALSE); 542 mediaPlayerState->setPlaying(FALSE);
534// toggleButton(1); 543// toggleButton(1);
535 } else { 544 } else {
536// toggleButton(0); 545// toggleButton(0);
537 mediaPlayerState->setPlaying(TRUE); 546 mediaPlayerState->setPlaying(TRUE);
538// toggleButton(0); 547// toggleButton(0);
539 } 548 }
540 } 549 }
541 break; 550 break;
542 case Key_Down: 551 case Key_Down:
543 toggleButton(6); 552 toggleButton(6);
544 emit lessClicked(); 553 emit lessClicked();
545 emit lessReleased(); 554 emit lessReleased();
546 toggleButton(6); 555 toggleButton(6);
547 break; 556 break;
548 case Key_Up: 557 case Key_Up:
549 toggleButton(5); 558 toggleButton(5);
550 emit moreClicked(); 559 emit moreClicked();
551 emit moreReleased(); 560 emit moreReleased();
552 toggleButton(5); 561 toggleButton(5);
553 break; 562 break;
554 case Key_Right: 563 case Key_Right:
555// toggleButton(3); 564// toggleButton(3);
556 mediaPlayerState->setNext(); 565 mediaPlayerState->setNext();
557// toggleButton(3); 566// toggleButton(3);
558 break; 567 break;
559 case Key_Left: 568 case Key_Left:
560// toggleButton(4); 569// toggleButton(4);
561 mediaPlayerState->setPrev(); 570 mediaPlayerState->setPrev();
562// toggleButton(4); 571// toggleButton(4);
563 break; 572 break;
564 case Key_Escape: 573 case Key_Escape:
565 break; 574 break;
566 575
567 }; 576 };
568} 577}
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index e05188e..772d1d1 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -1,149 +1,149 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#ifndef AUDIO_WIDGET_H 34#ifndef AUDIO_WIDGET_H
35#define AUDIO_WIDGET_H 35#define AUDIO_WIDGET_H
36 36
37#include <qwidget.h> 37#include <qwidget.h>
38#include <qpainter.h> 38#include <qpainter.h>
39#include <qdrawutil.h> 39#include <qdrawutil.h>
40#include <qpixmap.h> 40#include <qpixmap.h>
41#include <qstring.h> 41#include <qstring.h>
42#include <qslider.h> 42#include <qslider.h>
43#include <qframe.h> 43#include <qframe.h>
44#include <qlineedit.h> 44#include <qlineedit.h>
45 45
46 46
47class QPixmap; 47class QPixmap;
48 48
49enum AudioButtons { 49enum AudioButtons {
50 AudioPlay=0, 50 AudioPlay=0,
51 AudioStop, 51 AudioStop,
52 AudioPause, 52 AudioPause,
53 AudioNext, 53 AudioNext,
54 AudioPrevious, 54 AudioPrevious,
55 AudioVolumeUp, 55 AudioVolumeUp,
56 AudioVolumeDown, 56 AudioVolumeDown,
57 AudioLoop, 57 AudioLoop,
58 AudioPlayList, 58 AudioPlayList,
59 AudioForward, 59 AudioForward,
60 AudioBack 60 AudioBack
61}; 61};
62 62
63 63
64class Ticker : public QFrame { 64class Ticker : public QFrame {
65 Q_OBJECT 65 Q_OBJECT
66 66
67public: 67public:
68 Ticker( QWidget* parent=0 ); 68 Ticker( QWidget* parent=0 );
69 ~Ticker(); 69 ~Ticker();
70 void setText( const QString& text ) ; 70 void setText( const QString& text ) ;
71 71
72protected: 72protected:
73 void timerEvent( QTimerEvent * ); 73 void timerEvent( QTimerEvent * );
74 void drawContents( QPainter *p ); 74 void drawContents( QPainter *p );
75private: 75private:
76 QString scrollText; 76 QString scrollText;
77 int pos, pixelLen; 77 int pos, pixelLen;
78}; 78};
79 79
80 80
81class AudioWidget : public QWidget { 81class AudioWidget : public QWidget {
82 Q_OBJECT 82 Q_OBJECT
83public: 83public:
84 AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); 84 AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 );
85 ~AudioWidget(); 85 ~AudioWidget();
86 void setTickerText( const QString &text ) { songInfo.setText( text ); } 86 void setTickerText( const QString &text ) { songInfo.setText( text ); }
87 bool isStreaming; 87 bool isStreaming;
88public slots: 88public slots:
89 void updateSlider( long, long ); 89 void updateSlider( long, long );
90 void sliderPressed( ); 90 void sliderPressed( );
91 void sliderReleased( ); 91 void sliderReleased( );
92 void setPaused( bool b) { setToggleButton( AudioPause, b ); } 92 void setPaused( bool b) { setToggleButton( AudioPause, b ); }
93 void setLooping( bool b) { setToggleButton( AudioLoop, b ); } 93 void setLooping( bool b) { setToggleButton( AudioLoop, b ); }
94 void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } 94 void setPlaying( bool b) { setToggleButton( AudioPlay, b ); }
95 void setPosition( long ); 95 void setPosition( long );
96 void setLength( long ); 96 void setLength( long );
97 void setView( char ); 97 void setView( char );
98 98
99signals: 99signals:
100 void moreClicked(); 100 void moreClicked();
101 void lessClicked(); 101 void lessClicked();
102 void moreReleased(); 102 void moreReleased();
103 void lessReleased(); 103 void lessReleased();
104 void forwardClicked(); 104 void forwardClicked();
105 void backClicked(); 105 void backClicked();
106 void forwardReleased(); 106 void forwardReleased();
107 void backReleased(); 107 void backReleased();
108 void sliderMoved(long); 108 void sliderMoved(long);
109 109
110protected: 110protected:
111 void doBlank(); 111 void doBlank();
112 void doUnblank(); 112 void doUnblank();
113 void paintEvent( QPaintEvent *pe ); 113 void paintEvent( QPaintEvent *pe );
114 void showEvent( QShowEvent *se ); 114 void showEvent( QShowEvent *se );
115 void resizeEvent( QResizeEvent *re ); 115 void resizeEvent( QResizeEvent *re );
116 void mouseMoveEvent( QMouseEvent *event ); 116 void mouseMoveEvent( QMouseEvent *event );
117 void mousePressEvent( QMouseEvent *event ); 117 void mousePressEvent( QMouseEvent *event );
118 void mouseReleaseEvent( QMouseEvent *event ); 118 void mouseReleaseEvent( QMouseEvent *event );
119 void timerEvent( QTimerEvent *event ); 119 void timerEvent( QTimerEvent *event );
120 void closeEvent( QCloseEvent *event ); 120 void closeEvent( QCloseEvent *event );
121 void keyReleaseEvent( QKeyEvent *e); 121 void keyReleaseEvent( QKeyEvent *e);
122private slots: 122private slots:
123 void skipFor(); 123 void skipFor();
124 void skipBack(); 124 void skipBack();
125 void stopSkip(); 125 void stopSkip();
126private: 126private:
127 void toggleButton( int ); 127 void toggleButton( int );
128 void setToggleButton( int, bool ); 128 void setToggleButton( int, bool );
129 void paintButton( QPainter *p, int i ); 129 void paintButton( QPainter *p, int i );
130 int skipDirection; 130 int skipDirection;
131 QString skin; 131 QString skin;
132 QPixmap *pixBg; 132 QPixmap *pixBg;
133 QImage *imgUp; 133 QImage *imgUp;
134 QImage *imgDn; 134 QImage *imgDn;
135 QImage *imgButtonMask; 135 QImage *imgButtonMask;
136 QBitmap *masks[11]; 136 QBitmap *masks[10];
137 QPixmap *buttonPixUp[11]; 137 QPixmap *buttonPixUp[10];
138 QPixmap *buttonPixDown[11]; 138 QPixmap *buttonPixDown[10];
139 139
140 QPixmap *pixmaps[4]; 140 QPixmap *pixmaps[4];
141 Ticker songInfo; 141 Ticker songInfo;
142 QSlider slider; 142 QSlider slider;
143 QLineEdit time; 143 QLineEdit time;
144 int xoff, yoff; 144 int xoff, yoff;
145}; 145};
146 146
147 147
148#endif // AUDIO_WIDGET_H 148#endif // AUDIO_WIDGET_H
149 149