summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-08 22:26:34 (UTC)
committer simon <simon>2002-12-08 22:26:34 (UTC)
commit3b5f97272ded8a40da3853476371b4edc41d1a34 (patch) (side-by-side diff)
treecc965571aa2f8ca62bf859e49acc91b440b96f1a
parent5d3f3d429bb6247741a30c00a344302a2c9a20c0 (diff)
downloadopie-3b5f97272ded8a40da3853476371b4edc41d1a34.zip
opie-3b5f97272ded8a40da3853476371b4edc41d1a34.tar.gz
opie-3b5f97272ded8a40da3853476371b4edc41d1a34.tar.bz2
- share the imgButtonMask member variable in the base class
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h1
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h1
5 files changed, 14 insertions, 14 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index a9d5a88..022aa82 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -84,58 +84,58 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
buttons.push_back( toggleButton ); // play
buttons.push_back( defaultButton ); // stop
buttons.push_back( defaultButton ); // next
buttons.push_back( defaultButton ); // previous
buttons.push_back( defaultButton ); // volume up
buttons.push_back( defaultButton ); // volume down
buttons.push_back( toggleButton ); // repeat/loop
buttons.push_back( defaultButton ); // playlist
buttons.push_back( defaultButton ); // forward
buttons.push_back( defaultButton ); // back
setCaption( tr("OpiePlayer") );
Config cfg("OpiePlayer");
cfg.setGroup("Options");
skin = cfg.readEntry("Skin","default");
//skin = "scaleTest";
// color of background, frame, degree of transparency
QString skinPath = "opieplayer2/skins/" + skin;
pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
- imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
- imgButtonMask.fill( 0 );
+ buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
+ buttonMask.fill( 0 );
for ( int i = 0; i < 10; i++ ) {
QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" );
masks[i] = new QBitmap( filename );
if ( !masks[i]->isNull() ) {
QImage imgMask = masks[i]->convertToImage();
- uchar **dest = imgButtonMask.jumpTable();
+ uchar **dest = buttonMask.jumpTable();
for ( int y = 0; y < imgUp.height(); y++ ) {
uchar *line = dest[y];
for ( int x = 0; x < imgUp.width(); x++ )
if ( !qRed( imgMask.pixel( x, y ) ) )
line[x] = i + 1;
}
}
}
for ( int i = 0; i < 10; i++ ) {
buttonPixUp[i] = 0l;
buttonPixDown[i] = 0l;
}
setBackgroundPixmap( pixBg );
songInfo.setFocusPolicy( QWidget::NoFocus );
// changeTextColor( &songInfo );
// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
// songInfo.setFrameStyle( QFrame::NoFrame);
songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
// songInfo.setForegroundColor(Qt::white);
@@ -363,51 +363,51 @@ void AudioWidget::skipBack() {
void AudioWidget::stopSkip() {
killTimers();
}
void AudioWidget::timerEvent( QTimerEvent * ) {
if ( skipDirection == +1 ) {
mediaPlayerState.setPosition( mediaPlayerState.position() + 2 );
} else if ( skipDirection == -1 ) {
mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
}
}
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;
- bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width()
- && y < imgButtonMask.height()
- && imgButtonMask.pixelIndex( x, y ) == i + 1 );
+ bool isOnButton = ( x > 0 && y > 0 && x < buttonMask.width()
+ && y < buttonMask.height()
+ && buttonMask.pixelIndex( x, y ) == i + 1 );
if ( isOnButton && !buttons[i].isHeld ) {
buttons[i].isHeld = TRUE;
toggleButton(i);
switch (i) {
case VolumeUp:
emit moreClicked();
return;
case VolumeDown:
emit lessClicked();
return;
case Forward:
emit forwardClicked();
return;
case Back:
emit backClicked();
return;
}
} else if ( !isOnButton && buttons[i].isHeld ) {
buttons[i].isHeld = FALSE;
toggleButton(i);
}
} else {
if ( buttons[i].isHeld ) {
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 52a358c..da22946 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -78,40 +78,39 @@ signals:
protected:
void doBlank();
void doUnblank();
void paintEvent( QPaintEvent *pe );
void showEvent( QShowEvent *se );
void resizeEvent( QResizeEvent *re );
void mouseMoveEvent( QMouseEvent *event );
void mousePressEvent( QMouseEvent *event );
void mouseReleaseEvent( QMouseEvent *event );
void timerEvent( QTimerEvent *event );
void keyReleaseEvent( QKeyEvent *e);
private slots:
void skipFor();
void skipBack();
void stopSkip();
private:
void toggleButton( int );
void setToggleButton( int, bool );
void paintButton( QPainter *p, int i );
int skipDirection;
QString skin;
QPixmap pixBg;
QImage imgUp;
QImage imgDn;
- QImage imgButtonMask;
QBitmap *masks[10];
QPixmap *buttonPixUp[10];
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 b88d7e2..044ab6c 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -48,29 +48,31 @@ public:
MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 );
virtual ~MediaWidget();
public slots:
virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0;
virtual void setLength( long length ) = 0;
virtual void setPlaying( bool playing ) = 0;
signals:
void moreReleased();
void lessReleased();
void forwardReleased();
void backReleased();
protected:
virtual void closeEvent( QCloseEvent * );
void handleCommand( Command command, bool buttonDown );
MediaPlayerState &mediaPlayerState;
PlayListWidget &playList;
ButtonVector buttons;
+
+ QImage buttonMask;
};
#endif // MEDIAWIDGET_H
/* vim: et sw=4 ts=4
*/
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 7838229..459f592 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -78,58 +78,58 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
buttons.reserve( 7 );
buttons.push_back( defaultButton ); // stop
buttons.push_back( toggleButton ); // play
buttons.push_back( defaultButton ); // previous
buttons.push_back( defaultButton ); // next
buttons.push_back( defaultButton ); // volUp
buttons.push_back( defaultButton ); // volDown
buttons.push_back( toggleButton ); //fullscreen
videoFrame = new XineVideoWidget ( this, "Video frame" );
connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
Config cfg("OpiePlayer");
cfg.setGroup("Options");
skin = cfg.readEntry("Skin","default");
QString skinPath = "opieplayer2/skins/" + skin;
pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
- imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
- imgButtonMask.fill( 0 );
+ buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
+ buttonMask.fill( 0 );
for ( int i = 0; i < 7; i++ ) {
QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" );
masks[i] = new QBitmap( filename );
if ( !masks[i]->isNull() ) {
QImage imgMask = masks[i]->convertToImage();
- uchar **dest = imgButtonMask.jumpTable();
+ uchar **dest = buttonMask.jumpTable();
for ( int y = 0; y < imgUp.height(); y++ ) {
uchar *line = dest[y];
for ( int x = 0; x < imgUp.width(); x++ ) {
if ( !qRed( imgMask.pixel( x, y ) ) )
line[x] = i + 1;
}
}
}
}
for ( int i = 0; i < 7; i++ ) {
buttonPixUp[i] = NULL;
buttonPixDown[i] = NULL;
}
setBackgroundPixmap( pixBg );
slider = new QSlider( Qt::Horizontal, this );
slider->setMinValue( 0 );
slider->setMaxValue( 1 );
slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
//slider->setFocusPolicy( QWidget::NoFocus );
resizeEvent( NULL );
@@ -264,51 +264,51 @@ void VideoWidget::setToggleButton( int i, bool down ) {
}
void VideoWidget::toggleButton( int i ) {
buttons[i].isDown = !buttons[i].isDown;
QPainter p(this);
paintButton ( &p, i );
}
void VideoWidget::paintButton( QPainter *p, int i ) {
if ( buttons[i].isDown ) {
p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
} else {
p->drawPixmap( xoff, yoff, *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;
- bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width()
- && y < imgButtonMask.height()
- && imgButtonMask.pixelIndex( x, y ) == i + 1 );
+ bool isOnButton = ( x > 0 && y > 0 && x < buttonMask.width()
+ && y < buttonMask.height()
+ && buttonMask.pixelIndex( x, y ) == i + 1 );
if ( isOnButton && !buttons[i].isHeld ) {
buttons[i].isHeld = TRUE;
toggleButton(i);
switch (i) {
case VideoVolUp:
emit moreClicked();
return;
case VideoVolDown:
emit lessClicked();
return;
}
} else if ( !isOnButton && buttons[i].isHeld ) {
buttons[i].isHeld = FALSE;
toggleButton(i);
}
} else {
if ( buttons[i].isHeld ) {
buttons[i].isHeld = FALSE;
if ( !buttons[i].isToggle ) {
setToggleButton( i, FALSE );
}
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index f996803..a5500d7 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -79,49 +79,48 @@ public:
signals:
void moreClicked();
void lessClicked();
void moreReleased();
void lessReleased();
void sliderMoved( long );
void videoResized ( const QSize &s );
protected:
void resizeEvent( QResizeEvent * );
void paintEvent( QPaintEvent *pe );
void showEvent( QShowEvent *se );
void mouseMoveEvent( QMouseEvent *event );
void mousePressEvent( QMouseEvent *event );
void mouseReleaseEvent( QMouseEvent *event );
void keyReleaseEvent( QKeyEvent *e);
private:
// Ticker songInfo;
QPixmap pixBg;
QImage imgUp;
QImage imgDn;
- QImage imgButtonMask;
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 );
QString backgroundPix;
QSlider *slider;
QPixmap *pixmaps[3];
QImage *currentFrame;
int scaledWidth;
int scaledHeight;
XineVideoWidget* videoFrame;
};
#endif // VIDEO_WIDGET_H