summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-09 15:39:26 (UTC)
committer simon <simon>2002-12-09 15:39:26 (UTC)
commit21738c78103c42605625f85abf7bfd0d6beaad3f (patch) (side-by-side diff)
tree0d64cf6453265f4730025d4965b4fff6d1613115
parent9aa2442f6ea4e0d58fa7888995ebad04b3692049 (diff)
downloadopie-21738c78103c42605625f85abf7bfd0d6beaad3f.zip
opie-21738c78103c42605625f85abf7bfd0d6beaad3f.tar.gz
opie-21738c78103c42605625f85abf7bfd0d6beaad3f.tar.bz2
- merged duplicated setToggleButton method
- minor fixlet for paintAllButtons
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp8
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h1
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h1
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h1
6 files changed, 12 insertions, 17 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 277d162..8c7e614 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -300,24 +300,16 @@ void AudioWidget::updateSlider( long i, long max ) {
}
if ( slider.maxValue() != width ) {
slider.setMaxValue( width );
}
}
}
-
-void AudioWidget::setToggleButton( int i, bool down ) {
- qDebug("setToggleButton %d", i);
- if ( down != buttons[i].isDown ) {
- toggleButton( i );
- }
-}
-
void AudioWidget::skipFor() {
skipDirection = +1;
startTimer( 50 );
mediaPlayerState.setPosition( mediaPlayerState.position() + 2 );
}
void AudioWidget::skipBack() {
skipDirection = -1;
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 8c433ac..9b276b5 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -85,17 +85,16 @@ protected:
void mouseReleaseEvent( QMouseEvent *event );
void timerEvent( QTimerEvent *event );
void keyReleaseEvent( QKeyEvent *e);
private slots:
void skipFor();
void skipBack();
void stopSkip();
private:
- void setToggleButton( int, bool );
int skipDirection;
QString skin;
QImage imgUp;
QImage imgDn;
OTicker songInfo;
QSlider slider;
QLineEdit time;
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 271f788..9c5291b 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -92,33 +92,43 @@ bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const
position.y() < buttonMask.height() &&
buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 );
}
void MediaWidget::paintAllButtons( QPainter &p )
{
for ( ButtonMap::ConstIterator it = buttons.begin();
it != buttons.end(); ++it )
- paintButton( *it );
+ paintButton( p, *it );
}
void MediaWidget::paintButton( const Button &button )
{
QPainter p( this );
paintButton( p, button );
}
void MediaWidget::paintButton( QPainter &p, const Button &button )
{
if ( button.isDown )
p.drawPixmap( upperLeftOfButtonMask, button.pixDown );
else
p.drawPixmap( upperLeftOfButtonMask, button.pixUp );
}
+void MediaWidget::setToggleButton( int buttonId, bool down )
+{
+ qDebug("setToggleButton %d", buttonId );
+
+ Button &button = buttons[ buttonId ];
+
+ if ( down != button.isDown )
+ toggleButton( buttonId );
+}
+
void MediaWidget::toggleButton( int buttonId )
{
Button &button = buttons[ buttonId ];
button.isDown = !button.isDown;
paintButton( button );
}
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 34910fb..b7860dc 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -86,16 +86,17 @@ protected:
void handleCommand( Command command, bool buttonDown );
bool isOverButton( const QPoint &position, int buttonId ) const;
void paintAllButtons( QPainter &p );
void paintButton( const Button &button );
void paintButton( QPainter &p, const Button &button );
+ void setToggleButton( int buttonId, bool down );
void toggleButton( int buttonId );
MediaPlayerState &mediaPlayerState;
PlayListWidget &playList;
ButtonMap buttons;
QImage buttonMask;
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 8f6a8a9..db4a396 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -237,22 +237,16 @@ void VideoWidget::updateSlider( long i, long max ) {
slider->setValue( val );
}
if ( slider->maxValue() != width ) {
slider->setMaxValue( width );
}
}
}
-void VideoWidget::setToggleButton( int i, bool down ) {
- if ( down != buttons[i].isDown ) {
- toggleButton( i );
- }
-}
-
void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
for ( unsigned int i = 0; i < buttons.count(); i++ ) {
if ( event->state() == QMouseEvent::LeftButton ) {
// The test to see if the mouse click is inside the button or not
bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i );
if ( isOnButton && !buttons[i].isHeld ) {
buttons[i].isHeld = TRUE;
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index 45279d7..915e9cc 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -96,17 +96,16 @@ protected:
private:
// Ticker songInfo;
QImage imgUp;
QImage imgDn;
QString skin;
- void setToggleButton( int, bool );
QString backgroundPix;
QSlider *slider;
QImage *currentFrame;
int scaledWidth;
int scaledHeight;
XineVideoWidget* videoFrame;
};