summaryrefslogtreecommitdiff
path: root/noncore/multimedia
authorsimon <simon>2002-12-08 22:39:53 (UTC)
committer simon <simon>2002-12-08 22:39:53 (UTC)
commit8b72df0bb25ca5a0791756b2444fc6a1ce361082 (patch) (side-by-side diff)
tree19a7b23fe1d5256d461fe988ba82c359d75a8caf /noncore/multimedia
parentbada5d6377a428a96527d465903df7fbabc9d337 (diff)
downloadopie-8b72df0bb25ca5a0791756b2444fc6a1ce361082.zip
opie-8b72df0bb25ca5a0791756b2444fc6a1ce361082.tar.gz
opie-8b72df0bb25ca5a0791756b2444fc6a1ce361082.tar.bz2
- merged xoff/yoff into a QPointe member variable, shared in the base class
Diffstat (limited to 'noncore/multimedia') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp14
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h1
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp16
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h1
5 files changed, 17 insertions, 17 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 022aa82..4301a67 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -212,15 +212,15 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) );
slider.setFixedWidth( w - 110 );
slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
slider.setBackgroundOrigin( QWidget::ParentOrigin );
time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
- xoff = ( w - imgUp.width() ) / 2;
- yoff = (( h - imgUp.height() ) / 2) - 10;
- QPoint p( xoff, yoff );
+ upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2;
+ upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10;
+ QPoint p = upperLeftOfButtonMask;
QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p );
QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p );
for ( int i = 0; i < 10; i++ ) {
if ( !masks[i]->isNull() ) {
@@ -339,15 +339,15 @@ void AudioWidget::toggleButton( int i ) {
paintButton ( &p, i );
}
void AudioWidget::paintButton( QPainter *p, int i ) {
if ( buttons[i].isDown ) {
- p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
+ p->drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] );
} else {
- p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
+ p->drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] );
}
}
void AudioWidget::skipFor() {
skipDirection = +1;
@@ -378,14 +378,14 @@ void AudioWidget::timerEvent( QTimerEvent * ) {
void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
for ( unsigned int i = 0; i < buttons.size(); i++ ) {
if ( event->state() == QMouseEvent::LeftButton ) {
// The test to see if the mouse click is inside the button or not
- int x = event->pos().x() - xoff;
- int y = event->pos().y() - yoff;
+ int x = event->pos().x() - upperLeftOfButtonMask.x();
+ int y = event->pos().y() - upperLeftOfButtonMask.y();
bool isOnButton = ( x > 0 && y > 0 && x < buttonMask.width()
&& y < buttonMask.height()
&& buttonMask.pixelIndex( x, y ) == i + 1 );
if ( isOnButton && !buttons[i].isHeld ) {
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index da22946..acf2dda 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -104,13 +104,12 @@ private:
QPixmap *buttonPixDown[10];
QPixmap *pixmaps[4];
OTicker songInfo;
QSlider slider;
QLineEdit time;
- int xoff, yoff;
bool isStreaming : 1;
};
#endif // AUDIO_WIDGET_H
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 044ab6c..7e6cb3b 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -68,11 +68,13 @@ protected:
MediaPlayerState &mediaPlayerState;
PlayListWidget &playList;
ButtonVector buttons;
QImage buttonMask;
+
+ QPoint upperLeftOfButtonMask;
};
#endif // MEDIAWIDGET_H
/* vim: et sw=4 ts=4
*/
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 459f592..6ab6d7b 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -177,18 +177,18 @@ void VideoWidget::resizeEvent( QResizeEvent * ) {
slider->setFixedWidth( w - 20 );
slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
slider->setBackgroundOrigin( QWidget::ParentOrigin );
slider->setFocusPolicy( QWidget::NoFocus );
slider->setBackgroundPixmap( pixBg );
- xoff = 0;// ( imgUp->width() ) / 2;
+ upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2;
if(w>h)
- yoff = 0;
+ upperLeftOfButtonMask.ry() = 0;
else
- yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10;
- QPoint p( xoff, yoff );
+ upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10;
+ QPoint p = upperLeftOfButtonMask;
QPixmap *pixUp = combineVImageWithBackground( imgUp, pixBg, p );
QPixmap *pixDn = combineVImageWithBackground( imgDn, pixBg, p );
for ( int i = 0; i < 7; i++ ) {
if ( !masks[i]->isNull() ) {
@@ -269,24 +269,24 @@ void VideoWidget::toggleButton( int i ) {
paintButton ( &p, i );
}
void VideoWidget::paintButton( QPainter *p, int i ) {
if ( buttons[i].isDown ) {
- p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
+ p->drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] );
} else {
- p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
+ p->drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] );
}
}
void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
for ( unsigned int i = 0; i < buttons.size(); i++ ) {
if ( event->state() == QMouseEvent::LeftButton ) {
// The test to see if the mouse click is inside the button or not
- int x = event->pos().x() - xoff;
- int y = event->pos().y() - yoff;
+ int x = event->pos().x() - upperLeftOfButtonMask.x();
+ int y = event->pos().y() - upperLeftOfButtonMask.y();
bool isOnButton = ( x > 0 && y > 0 && x < buttonMask.width()
&& y < buttonMask.height()
&& buttonMask.pixelIndex( x, y ) == i + 1 );
if ( isOnButton && !buttons[i].isHeld ) {
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index a5500d7..2a9f1e0 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -102,13 +102,12 @@ private:
QImage imgDn;
QBitmap *masks[7];
QPixmap *buttonPixUp[7];
QPixmap *buttonPixDown[7];
QString skin;
// QPixmap *pixmaps[4];
- int xoff, yoff;
void paintButton( QPainter *p, int i );
void toggleButton( int );
void setToggleButton( int, bool );