author | llornkcor <llornkcor> | 2002-02-24 21:51:51 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-24 21:51:51 (UTC) |
commit | 36b768c465c6ecddceb57ff1d7a5087e9848c897 (patch) (unidiff) | |
tree | 4ddde589e2393ca136e24cda4fc456612149ae72 /core/multimedia/opieplayer/audiowidget.cpp | |
parent | ade25ac278169f0e0c9ee0771e754adb46cf7ce2 (diff) | |
download | opie-36b768c465c6ecddceb57ff1d7a5087e9848c897.zip opie-36b768c465c6ecddceb57ff1d7a5087e9848c897.tar.gz opie-36b768c465c6ecddceb57ff1d7a5087e9848c897.tar.bz2 |
changed mediaplayerplugininterface.h location
Diffstat (limited to 'core/multimedia/opieplayer/audiowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.cpp | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index 243c58c..0d88591 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp | |||
@@ -62,5 +62,5 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
62 | QWidget( parent, name, f ) | 62 | QWidget( parent, name, f ) |
63 | { | 63 | { |
64 | setCaption( tr("MediaPlayer") ); | 64 | setCaption( tr("OpiePlayer") ); |
65 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); | 65 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); |
66 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsAll" ) ); | 66 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsAll" ) ); |
@@ -105,5 +105,5 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
105 | AudioWidget::~AudioWidget() { | 105 | AudioWidget::~AudioWidget() { |
106 | for ( int i = 0; i < 4; i++ ) | 106 | for ( int i = 0; i < 4; i++ ) |
107 | delete pixmaps[i]; | 107 | delete pixmaps[i]; |
108 | } | 108 | } |
109 | 109 | ||
@@ -120,5 +120,5 @@ void AudioWidget::sliderReleased() { | |||
120 | audioSliderBeingMoved = FALSE; | 120 | audioSliderBeingMoved = FALSE; |
121 | if ( slider->width() == 0 ) | 121 | if ( slider->width() == 0 ) |
122 | return; | 122 | return; |
123 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); | 123 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); |
124 | mediaPlayerState->setPosition( val ); | 124 | mediaPlayerState->setPosition( val ); |
@@ -138,9 +138,9 @@ void AudioWidget::setLength( long max ) { | |||
138 | void AudioWidget::setView( char view ) { | 138 | void AudioWidget::setView( char view ) { |
139 | if ( view == 'a' ) { | 139 | if ( view == 'a' ) { |
140 | startTimer( 150 ); | 140 | startTimer( 150 ); |
141 | showMaximized(); | 141 | showMaximized(); |
142 | } else { | 142 | } else { |
143 | killTimers(); | 143 | killTimers(); |
144 | hide(); | 144 | hide(); |
145 | } | 145 | } |
146 | } | 146 | } |
@@ -149,5 +149,5 @@ void AudioWidget::setView( char view ) { | |||
149 | void AudioWidget::updateSlider( long i, long max ) { | 149 | void AudioWidget::updateSlider( long i, long max ) { |
150 | if ( max == 0 ) | 150 | if ( max == 0 ) |
151 | return; | 151 | return; |
152 | // Will flicker too much if we don't do this | 152 | // Will flicker too much if we don't do this |
153 | // Scale to something reasonable | 153 | // Scale to something reasonable |
@@ -155,8 +155,8 @@ void AudioWidget::updateSlider( long i, long max ) { | |||
155 | int val = int((double)i * width / max); | 155 | int val = int((double)i * width / max); |
156 | if ( !audioSliderBeingMoved ) { | 156 | if ( !audioSliderBeingMoved ) { |
157 | if ( slider->value() != val ) | 157 | if ( slider->value() != val ) |
158 | slider->setValue( val ); | 158 | slider->setValue( val ); |
159 | if ( slider->maxValue() != width ) | 159 | if ( slider->maxValue() != width ) |
160 | slider->setMaxValue( width ); | 160 | slider->setMaxValue( width ); |
161 | } | 161 | } |
162 | } | 162 | } |
@@ -165,5 +165,5 @@ void AudioWidget::updateSlider( long i, long max ) { | |||
165 | void AudioWidget::setToggleButton( int i, bool down ) { | 165 | void AudioWidget::setToggleButton( int i, bool down ) { |
166 | if ( down != audioButtons[i].isDown ) | 166 | if ( down != audioButtons[i].isDown ) |
167 | toggleButton( i ); | 167 | toggleButton( i ); |
168 | } | 168 | } |
169 | 169 | ||
@@ -189,11 +189,11 @@ void AudioWidget::timerEvent( QTimerEvent * ) { | |||
189 | static int frame = 0; | 189 | static int frame = 0; |
190 | if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) { | 190 | if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) { |
191 | frame = frame >= 7 ? 0 : frame + 1; | 191 | frame = frame >= 7 ? 0 : frame + 1; |
192 | int x = audioButtons[AudioPlay].xPos; | 192 | int x = audioButtons[AudioPlay].xPos; |
193 | int y = audioButtons[AudioPlay].yPos; | 193 | int y = audioButtons[AudioPlay].yPos; |
194 | QPainter p( this ); | 194 | QPainter p( this ); |
195 | // Optimize to only draw the little bit of the changing images which is different | 195 | // Optimize to only draw the little bit of the changing images which is different |
196 | p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 ); | 196 | p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 ); |
197 | p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 ); | 197 | p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 ); |
198 | } | 198 | } |
199 | } | 199 | } |
@@ -202,46 +202,46 @@ void AudioWidget::timerEvent( QTimerEvent * ) { | |||
202 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 202 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
203 | for ( int i = 0; i < numButtons; i++ ) { | 203 | for ( int i = 0; i < numButtons; i++ ) { |
204 | int size = audioButtons[i].isBig; | 204 | int size = audioButtons[i].isBig; |
205 | int x = audioButtons[i].xPos; | 205 | int x = audioButtons[i].xPos; |
206 | int y = audioButtons[i].yPos; | 206 | int y = audioButtons[i].yPos; |
207 | if ( event->state() == QMouseEvent::LeftButton ) { | 207 | if ( event->state() == QMouseEvent::LeftButton ) { |
208 | // The test to see if the mouse click is inside the circular button or not | 208 | // The test to see if the mouse click is inside the circular button or not |
209 | // (compared with the radius squared to avoid a square-root of our distance) | 209 | // (compared with the radius squared to avoid a square-root of our distance) |
210 | int radius = 32 + 13 * size; | 210 | int radius = 32 + 13 * size; |
211 | QPoint center = QPoint( x + radius, y + radius ); | 211 | QPoint center = QPoint( x + radius, y + radius ); |
212 | QPoint dXY = center - event->pos(); | 212 | QPoint dXY = center - event->pos(); |
213 | int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); | 213 | int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); |
214 | bool isOnButton = dist <= (radius * radius); | 214 | bool isOnButton = dist <= (radius * radius); |
215 | // QRect r( x, y, 64 + 22*size, 64 + 22*size ); | 215 | // QRect r( x, y, 64 + 22*size, 64 + 22*size ); |
216 | // bool isOnButton = r.contains( event->pos() ); // Rectangular Button code | 216 | // bool isOnButton = r.contains( event->pos() ); // Rectangular Button code |
217 | if ( isOnButton && !audioButtons[i].isHeld ) { | 217 | if ( isOnButton && !audioButtons[i].isHeld ) { |
218 | audioButtons[i].isHeld = TRUE; | 218 | audioButtons[i].isHeld = TRUE; |
219 | toggleButton(i); | 219 | toggleButton(i); |
220 | switch (i) { | 220 | switch (i) { |
221 | case AudioVolumeUp: emit moreClicked(); return; | 221 | case AudioVolumeUp: emit moreClicked(); return; |
222 | case AudioVolumeDown: emit lessClicked(); return; | 222 | case AudioVolumeDown: emit lessClicked(); return; |
223 | } | 223 | } |
224 | } else if ( !isOnButton && audioButtons[i].isHeld ) { | 224 | } else if ( !isOnButton && audioButtons[i].isHeld ) { |
225 | audioButtons[i].isHeld = FALSE; | 225 | audioButtons[i].isHeld = FALSE; |
226 | toggleButton(i); | 226 | toggleButton(i); |
227 | } | 227 | } |
228 | } else { | 228 | } else { |
229 | if ( audioButtons[i].isHeld ) { | 229 | if ( audioButtons[i].isHeld ) { |
230 | audioButtons[i].isHeld = FALSE; | 230 | audioButtons[i].isHeld = FALSE; |
231 | if ( !audioButtons[i].isToggle ) | 231 | if ( !audioButtons[i].isToggle ) |
232 | setToggleButton( i, FALSE ); | 232 | setToggleButton( i, FALSE ); |
233 | switch (i) { | 233 | switch (i) { |
234 | case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; | 234 | case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; |
235 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; | 235 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; |
236 | case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return; | 236 | case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return; |
237 | case AudioNext: mediaPlayerState->setNext(); return; | 237 | case AudioNext: mediaPlayerState->setNext(); return; |
238 | case AudioPrevious: mediaPlayerState->setPrev(); return; | 238 | case AudioPrevious: mediaPlayerState->setPrev(); return; |
239 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; | 239 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; |
240 | case AudioVolumeUp: emit moreReleased(); return; | 240 | case AudioVolumeUp: emit moreReleased(); return; |
241 | case AudioVolumeDown: emit lessReleased(); return; | 241 | case AudioVolumeDown: emit lessReleased(); return; |
242 | case AudioPlayList: mediaPlayerState->setList(); return; | 242 | case AudioPlayList: mediaPlayerState->setList(); return; |
243 | } | 243 | } |
244 | } | 244 | } |
245 | } | 245 | } |
246 | } | 246 | } |
247 | } | 247 | } |
@@ -272,5 +272,5 @@ void AudioWidget::paintEvent( QPaintEvent * ) { | |||
272 | QPainter p( this ); | 272 | QPainter p( this ); |
273 | for ( int i = 0; i < numButtons; i++ ) | 273 | for ( int i = 0; i < numButtons; i++ ) |
274 | paintButton( &p, i ); | 274 | paintButton( &p, i ); |
275 | } | 275 | } |
276 | 276 | ||