summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-08-09 19:16:11 (UTC)
committer harlekin <harlekin>2002-08-09 19:16:11 (UTC)
commitd8e5c405aa6bf33b8b1d59443926876e8f056e5b (patch) (side-by-side diff)
tree6b901dc26eef008f3c2797e1022b51d9bb2a569b
parentf0d1b8604699b964303288877db7b85a24222f5c (diff)
downloadopie-d8e5c405aa6bf33b8b1d59443926876e8f056e5b.zip
opie-d8e5c405aa6bf33b8b1d59443926876e8f056e5b.tar.gz
opie-d8e5c405aa6bf33b8b1d59443926876e8f056e5b.tar.bz2
skip buttons connected
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp105
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h51
2 files changed, 134 insertions, 22 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 955169c..6b656ee 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -1,6 +1,38 @@
+/*
+                This file is part of the Opie Project
+
+              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
+ Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
+ Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qwidget.h>
@@ -159,12 +191,19 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
+ connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) );
+ connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) );
+ connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) );
+ connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) );
+
+
+
// Intialise state
setLength( mediaPlayerState->length() );
setPosition( mediaPlayerState->position() );
setLooping( mediaPlayerState->fullscreen() );
setPaused( mediaPlayerState->paused() );
setPlaying( mediaPlayerState->playing() );
@@ -338,13 +377,37 @@ void AudioWidget::paintButton( QPainter *p, int i ) {
p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
else
p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
}
+void AudioWidget::skipFor() {
+ skipDirection = +1;
+ startTimer( 50 );
+ mediaPlayerState->setPosition( mediaPlayerState->position() + 2 );
+}
+
+void AudioWidget::skipBack() {
+ skipDirection = -1;
+ startTimer( 50 );
+ mediaPlayerState->setPosition( mediaPlayerState->position() - 2 );
+}
+
+
+
+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 ( int i = 0; i < numButtons; i++ ) {
if ( event->state() == QMouseEvent::LeftButton ) {
@@ -360,41 +423,49 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
qDebug("on up");
if ( isOnButton && !audioButtons[i].isHeld ) {
audioButtons[i].isHeld = TRUE;
toggleButton(i);
switch (i) {
- case AudioVolumeUp:
- qDebug("more clicked");
- emit moreClicked();
- return;
- case AudioVolumeDown:
- emit lessClicked();
- return;
+ case AudioVolumeUp:
+ qDebug("more clicked");
+ emit moreClicked();
+ return;
+ case AudioVolumeDown:
+ emit lessClicked();
+ return;
+ case AudioForward:
+ emit forwardClicked();
+ return;
+ case AudioBack:
+ emit backClicked();
+ return;
}
} else if ( !isOnButton && audioButtons[i].isHeld ) {
audioButtons[i].isHeld = FALSE;
toggleButton(i);
}
} else {
if ( audioButtons[i].isHeld ) {
audioButtons[i].isHeld = FALSE;
if ( !audioButtons[i].isToggle ) {
setToggleButton( i, FALSE );
- qDebug("button toggled3 %d",i);
+ qDebug("button toggled3 %d",i);
}
switch (i) {
- case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return;
- case AudioStop: mediaPlayerState->setPlaying(FALSE); return;
- case AudioPause: mediaPlayerState->setPaused( audioButtons[i].isDown); return;
- case AudioNext: mediaPlayerState->setNext(); return;
- case AudioPrevious: mediaPlayerState->setPrev(); return;
- case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return;
- case AudioVolumeUp: emit moreReleased(); return;
- case AudioVolumeDown: emit lessReleased(); return;
- case AudioPlayList: mediaPlayerState->setList(); return;
+ case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return;
+ case AudioStop: mediaPlayerState->setPlaying(FALSE); return;
+ case AudioPause: mediaPlayerState->setPaused( audioButtons[i].isDown); return;
+ case AudioNext: mediaPlayerState->setNext(); return;
+ case AudioPrevious: mediaPlayerState->setPrev(); return;
+ case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return;
+ case AudioVolumeUp: emit moreReleased(); return;
+ case AudioVolumeDown: emit lessReleased(); return;
+ case AudioPlayList: mediaPlayerState->setList(); return;
+ case AudioForward: emit forwardReleased(); return;
+ case AudioBack: emit backReleased(); return;
}
}
}
}
}
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 2b892be..e05188e 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -1,6 +1,39 @@
+/*
+                This file is part of the Opie Project
+
+              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
+ Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
+ Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
#ifndef AUDIO_WIDGET_H
#define AUDIO_WIDGET_H
#include <qwidget.h>
#include <qpainter.h>
#include <qdrawutil.h>
@@ -19,19 +52,18 @@ enum AudioButtons {
AudioPause,
AudioNext,
AudioPrevious,
AudioVolumeUp,
AudioVolumeDown,
AudioLoop,
- AudioPlayList
+ AudioPlayList,
+ AudioForward,
+ AudioBack
};
-//#define USE_DBLBUF
-
-
class Ticker : public QFrame {
Q_OBJECT
public:
Ticker( QWidget* parent=0 );
~Ticker();
@@ -66,12 +98,16 @@ public slots:
signals:
void moreClicked();
void lessClicked();
void moreReleased();
void lessReleased();
+ void forwardClicked();
+ void backClicked();
+ void forwardReleased();
+ void backReleased();
void sliderMoved(long);
protected:
void doBlank();
void doUnblank();
void paintEvent( QPaintEvent *pe );
@@ -80,25 +116,30 @@ protected:
void mouseMoveEvent( QMouseEvent *event );
void mousePressEvent( QMouseEvent *event );
void mouseReleaseEvent( QMouseEvent *event );
void timerEvent( QTimerEvent *event );
void closeEvent( QCloseEvent *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[11];
QPixmap *buttonPixUp[11];
QPixmap *buttonPixDown[11];
-
+
QPixmap *pixmaps[4];
Ticker songInfo;
QSlider slider;
QLineEdit time;
int xoff, yoff;
};