summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp45
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h5
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp44
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h6
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp40
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h1
6 files changed, 50 insertions, 91 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 37c565b..dda039c 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -324,69 +324,24 @@ 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 ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) {
- Button &button = *it;
- Command command = button.command;
-
- 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, command );
-
- if ( isOnButton && !button.isHeld ) {
- button.isHeld = TRUE;
- toggleButton( button );
- switch ( command ) {
- case VolumeUp:
- emit moreClicked();
- return;
- case VolumeDown:
- emit lessClicked();
- return;
- case Forward:
- emit forwardClicked();
- return;
- case Back:
- emit backClicked();
- return;
- default: break;
- }
- } else if ( !isOnButton && button.isHeld ) {
- button.isHeld = FALSE;
- toggleButton( button );
- }
- } else {
- if ( button.isHeld ) {
- button.isHeld = FALSE;
- if ( button.type != ToggleButton ) {
- setToggleButton( button, FALSE );
- }
- handleCommand( command, button.isDown );
- }
- }
- }
-}
-
-
void AudioWidget::mousePressEvent( QMouseEvent *event ) {
mouseMoveEvent( event );
}
void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) {
mouseMoveEvent( event );
}
void AudioWidget::showEvent( QShowEvent* ) {
QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 9b276b5..690d1b3 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -60,36 +60,31 @@ public slots:
void sliderPressed( );
void sliderReleased( );
void setLooping( bool b) { setToggleButton( Loop, b ); }
void setPosition( long );
void setSeekable( bool );
public:
virtual void setLength( long );
virtual void setPlaying( bool b) { setToggleButton( Play, b ); }
virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
signals:
- void moreClicked();
- void lessClicked();
- void forwardClicked();
- void backClicked();
void sliderMoved(long);
protected:
void doBlank();
void doUnblank();
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:
int skipDirection;
QString skin;
QImage imgUp;
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 7eb75e6..3533d74 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -60,24 +60,68 @@ void MediaWidget::paintEvent( QPaintEvent *pe )
QPainter p( &pix );
p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() );
paintAllButtons( p );
QPainter p2( this );
p2.drawPixmap( pe->rect().topLeft(), pix );
} else {
QPainter p( this );
paintAllButtons( p );
}
}
+void MediaWidget::mouseMoveEvent( QMouseEvent *event )
+{
+ for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) {
+ Button &button = *it;
+ Command command = button.command;
+
+ 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, command );
+
+ if ( isOnButton && !button.isHeld ) {
+ button.isHeld = TRUE;
+ toggleButton( button );
+ switch ( command ) {
+ case VolumeUp:
+ emit moreClicked();
+ return;
+ case VolumeDown:
+ emit lessClicked();
+ return;
+ case Forward:
+ emit forwardClicked();
+ return;
+ case Back:
+ emit backClicked();
+ return;
+ default: break;
+ }
+ } else if ( !isOnButton && button.isHeld ) {
+ button.isHeld = FALSE;
+ toggleButton( button );
+ }
+ } else {
+ if ( button.isHeld ) {
+ button.isHeld = FALSE;
+ if ( button.type != ToggleButton ) {
+ setToggleButton( button, FALSE );
+ }
+ handleCommand( command, button.isDown );
+ }
+ }
+ }
+}
+
void MediaWidget::makeVisible()
{
}
void MediaWidget::handleCommand( Command command, bool buttonDown )
{
switch ( command ) {
case Play: mediaPlayerState.togglePaused();
case Stop: mediaPlayerState.setPlaying(FALSE); return;
case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return;
case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return;
case Loop: mediaPlayerState.setLooping( buttonDown ); return;
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 3f4c45d..c19fdbb 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -68,30 +68,36 @@ public:
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();
+ void forwardClicked();
+ void backClicked();
+ void moreClicked();
+ void lessClicked();
protected:
virtual void closeEvent( QCloseEvent * );
virtual void paintEvent( QPaintEvent *pe );
+ virtual void mouseMoveEvent( QMouseEvent *event );
+
virtual void makeVisible();
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( Button &button, bool down );
void setToggleButton( Command command, bool down );
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index cc586cc..41844e1 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -234,64 +234,24 @@ void VideoWidget::updateSlider( long i, long max ) {
int width = slider->width();
int val = int((double)i * width / max);
if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) {
if ( slider->value() != val ) {
slider->setValue( val );
}
if ( slider->maxValue() != width ) {
slider->setMaxValue( width );
}
}
}
-void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
- for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) {
- Button &button = *it;
- Command command = button.command;
-
- 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, command );
-
- if ( isOnButton && !button.isHeld ) {
- button.isHeld = TRUE;
- toggleButton( button );
-
- switch ( command ) {
- case VolumeUp:
- emit moreClicked();
- return;
- case VolumeDown:
- emit lessClicked();
- return;
- default: break;
- }
- } else if ( !isOnButton && button.isHeld ) {
- button.isHeld = FALSE;
- toggleButton( button );
- }
- } else {
-
- if ( button.isHeld ) {
- button.isHeld = FALSE;
- if ( button.type != ToggleButton ) {
- setToggleButton( button, FALSE );
- }
-
- handleCommand( command, button.isDown );
- }
- }
- }
-}
-
void VideoWidget::mousePressEvent( QMouseEvent *event ) {
mouseMoveEvent( event );
}
void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
if ( mediaPlayerState.isFullscreen() ) {
mediaPlayerState.setFullscreen( FALSE );
makeVisible();
}
mouseMoveEvent( event );
}
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index ef88186..7d50ea0 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -67,25 +67,24 @@ public:
virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
signals:
void moreClicked();
void lessClicked();
void sliderMoved( long );
void videoResized ( const QSize &s );
protected:
void resizeEvent( QResizeEvent * );
void showEvent( QShowEvent *se );
- void mouseMoveEvent( QMouseEvent *event );
void mousePressEvent( QMouseEvent *event );
void mouseReleaseEvent( QMouseEvent *event );
void keyReleaseEvent( QKeyEvent *e);
private:
// Ticker songInfo;
QImage imgUp;
QImage imgDn;
QString skin;