summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/audiowidget.cpp
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/audiowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp
index 54e7ceb..b96b1ef 100644
--- a/core/multimedia/opieplayer/audiowidget.cpp
+++ b/core/multimedia/opieplayer/audiowidget.cpp
@@ -67,31 +67,31 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
67{ 67{
68 setCaption( tr("OpiePlayer") ); 68 setCaption( tr("OpiePlayer") );
69 Config cfg("OpiePlayer"); 69 Config cfg("OpiePlayer");
70 cfg.setGroup("AudioWidget"); 70 cfg.setGroup("AudioWidget");
71// QGridLayout *layout = new QGridLayout( this ); 71// QGridLayout *layout = new QGridLayout( this );
72// layout->setSpacing( 2); 72// layout->setSpacing( 2);
73// layout->setMargin( 2); 73// layout->setMargin( 2);
74 QString backgroundPix, buttonsAllPix, buttonsBigPix, controlsPix, animatedPix; 74 QString backgroundPix, buttonsAllPix, buttonsBigPix, controlsPix, animatedPix;
75 backgroundPix=cfg.readEntry( " backgroundPix", "opieplayer/metalFinish"); 75 backgroundPix=cfg.readEntry( " backgroundPix", "opieplayer/metalFinish");
76 buttonsAllPix=cfg.readEntry( "buttonsAllPix","opieplayer/mediaButtonsAll"); 76 buttonsAllPix=cfg.readEntry( "buttonsAllPix","opieplayer/mediaButtonsAll");
77 buttonsBigPix=cfg.readEntry( "buttonsBigPix","opieplayer/mediaButtonsBig"); 77 buttonsBigPix=cfg.readEntry( "buttonsBigPix","opieplayer/mediaButtonsBig");
78 controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls"); 78 controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls");
79 animatedPix=cfg.readEntry( "animatedPix", "opieplayer/animatedButton"); 79// animatedPix=cfg.readEntry( "animatedPix", "opieplayer/animatedButton");
80 80
81 setBackgroundPixmap( Resource::loadPixmap( backgroundPix) ); 81 setBackgroundPixmap( Resource::loadPixmap( backgroundPix) );
82 pixmaps[0] = new QPixmap( Resource::loadPixmap( buttonsAllPix ) ); 82 pixmaps[0] = new QPixmap( Resource::loadPixmap( buttonsAllPix ) );
83 pixmaps[1] = new QPixmap( Resource::loadPixmap( buttonsBigPix ) ); 83 pixmaps[1] = new QPixmap( Resource::loadPixmap( buttonsBigPix ) );
84 pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix ) ); 84 pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix ) );
85 pixmaps[3] = new QPixmap( Resource::loadPixmap( animatedPix) ); 85// pixmaps[3] = new QPixmap( Resource::loadPixmap( animatedPix) );
86 86
87 songInfo = new Ticker( this ); 87 songInfo = new Ticker( this );
88 songInfo->setFocusPolicy( QWidget::NoFocus ); 88 songInfo->setFocusPolicy( QWidget::NoFocus );
89 songInfo->setGeometry( QRect( 7, 3, 220, 20 ) ); 89 songInfo->setGeometry( QRect( 7, 3, 220, 20 ) );
90// layout->addMultiCellWidget( songInfo, 0, 0, 0, 2 ); 90// layout->addMultiCellWidget( songInfo, 0, 0, 0, 2 );
91 91
92 slider = new QSlider( Qt::Horizontal, this ); 92 slider = new QSlider( Qt::Horizontal, this );
93 slider->setFixedWidth( 220 ); 93 slider->setFixedWidth( 220 );
94 slider->setFixedHeight( 20 ); 94 slider->setFixedHeight( 20 );
95 slider->setMinValue( 0 ); 95 slider->setMinValue( 0 );
96 slider->setMaxValue( 1 ); 96 slider->setMaxValue( 1 );
97 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 97 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
@@ -111,25 +111,25 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
111 // Intialise state 111 // Intialise state
112 setLength( mediaPlayerState->length() ); 112 setLength( mediaPlayerState->length() );
113 setPosition( mediaPlayerState->position() ); 113 setPosition( mediaPlayerState->position() );
114 setLooping( mediaPlayerState->fullscreen() ); 114 setLooping( mediaPlayerState->fullscreen() );
115 setPaused( mediaPlayerState->paused() ); 115 setPaused( mediaPlayerState->paused() );
116 setPlaying( mediaPlayerState->playing() ); 116 setPlaying( mediaPlayerState->playing() );
117 117
118} 118}
119 119
120 120
121AudioWidget::~AudioWidget() { 121AudioWidget::~AudioWidget() {
122 mediaPlayerState->isStreaming = FALSE; 122 mediaPlayerState->isStreaming = FALSE;
123 for ( int i = 0; i < 4; i++ ) 123 for ( int i = 0; i < 3; i++ )
124 delete pixmaps[i]; 124 delete pixmaps[i];
125} 125}
126 126
127 127
128static bool audioSliderBeingMoved = FALSE; 128static bool audioSliderBeingMoved = FALSE;
129 129
130 130
131void AudioWidget::sliderPressed() { 131void AudioWidget::sliderPressed() {
132 audioSliderBeingMoved = TRUE; 132 audioSliderBeingMoved = TRUE;
133} 133}
134 134
135 135
@@ -211,30 +211,30 @@ void AudioWidget::paintButton( QPainter *p, int i ) {
211 int y = audioButtons[i].yPos; 211 int y = audioButtons[i].yPos;
212 int offset = 22 + 14 * audioButtons[i].isBig + audioButtons[i].isDown; 212 int offset = 22 + 14 * audioButtons[i].isBig + audioButtons[i].isDown;
213 int buttonSize = 64 + audioButtons[i].isBig * (90 - 64); 213 int buttonSize = 64 + audioButtons[i].isBig * (90 - 64);
214 p->drawPixmap( x, y, *pixmaps[audioButtons[i].isBig], buttonSize * (audioButtons[i].isDown + 2 * audioButtons[i].color), 0, buttonSize, buttonSize ); 214 p->drawPixmap( x, y, *pixmaps[audioButtons[i].isBig], buttonSize * (audioButtons[i].isDown + 2 * audioButtons[i].color), 0, buttonSize, buttonSize );
215 p->drawPixmap( x + offset, y + offset, *pixmaps[2], 18 * i, 0, 18, 18 ); 215 p->drawPixmap( x + offset, y + offset, *pixmaps[2], 18 * i, 0, 18, 18 );
216} 216}
217 217
218 218
219void AudioWidget::timerEvent( QTimerEvent * ) { 219void AudioWidget::timerEvent( QTimerEvent * ) {
220 static int frame = 0; 220 static int frame = 0;
221 if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) { 221 if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) {
222 frame = frame >= 7 ? 0 : frame + 1; 222 frame = frame >= 7 ? 0 : frame + 1;
223 int x = audioButtons[AudioPlay].xPos; 223// int x = audioButtons[AudioPlay].xPos;
224 int y = audioButtons[AudioPlay].yPos; 224// int y = audioButtons[AudioPlay].yPos;
225 QPainter p( this ); 225// QPainter p( this );
226 // Optimize to only draw the little bit of the changing images which is different 226// // Optimize to only draw the little bit of the changing images which is different
227 p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 ); 227// p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 );
228 p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 ); 228// p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 );
229 } 229 }
230} 230}
231 231
232 232
233void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { 233void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
234 for ( int i = 0; i < numButtons; i++ ) { 234 for ( int i = 0; i < numButtons; i++ ) {
235 int size = audioButtons[i].isBig; 235 int size = audioButtons[i].isBig;
236 int x = audioButtons[i].xPos; 236 int x = audioButtons[i].xPos;
237 int y = audioButtons[i].yPos; 237 int y = audioButtons[i].yPos;
238 if ( event->state() == QMouseEvent::LeftButton ) { 238 if ( event->state() == QMouseEvent::LeftButton ) {
239 // The test to see if the mouse click is inside the circular button or not 239 // The test to see if the mouse click is inside the circular button or not
240 // (compared with the radius squared to avoid a square-root of our distance) 240 // (compared with the radius squared to avoid a square-root of our distance)