author | harlekin <harlekin> | 2002-08-09 19:16:11 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-09 19:16:11 (UTC) |
commit | d8e5c405aa6bf33b8b1d59443926876e8f056e5b (patch) (unidiff) | |
tree | 6b901dc26eef008f3c2797e1022b51d9bb2a569b | |
parent | f0d1b8604699b964303288877db7b85a24222f5c (diff) | |
download | opie-d8e5c405aa6bf33b8b1d59443926876e8f056e5b.zip opie-d8e5c405aa6bf33b8b1d59443926876e8f056e5b.tar.gz opie-d8e5c405aa6bf33b8b1d59443926876e8f056e5b.tar.bz2 |
skip buttons connected
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 105 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 51 |
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,3 +1,35 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | ||
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | ||
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | ||
7 | =. | ||
8 | .=l. | ||
9 | .>+-= | ||
10 | _;:, .> :=|. This program is free software; you can | ||
11 | .> <`_, > . <= redistribute it and/or modify it under | ||
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
13 | .="- .-=="i, .._ License as published by the Free Software | ||
14 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
15 | ._= =} : or (at your option) any later version. | ||
16 | .%`+i> _;_. | ||
17 | .i_,=:_. -<s. This program is distributed in the hope that | ||
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
19 | : .. .:, . . . without even the implied warranty of | ||
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
22 | ..}^=.= = ; Library General Public License for more | ||
23 | ++= -. .` .: details. | ||
24 | : = ...= . :.=- | ||
25 | -. .:....=;==+<; You should have received a copy of the GNU | ||
26 | -_. . . )=. = Library General Public License along with | ||
27 | -- :-=` this library; see the file COPYING.LIB. | ||
28 | If not, write to the Free Software Foundation, | ||
29 | Inc., 59 Temple Place - Suite 330, | ||
30 | Boston, MA 02111-1307, USA. | ||
31 | |||
32 | */ | ||
1 | 33 | ||
2 | #include <qpe/qpeapplication.h> | 34 | #include <qpe/qpeapplication.h> |
3 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
@@ -162,6 +194,13 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
162 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 194 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
163 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 195 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
164 | 196 | ||
197 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | ||
198 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); | ||
199 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); | ||
200 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); | ||
201 | |||
202 | |||
203 | |||
165 | // Intialise state | 204 | // Intialise state |
166 | setLength( mediaPlayerState->length() ); | 205 | setLength( mediaPlayerState->length() ); |
167 | setPosition( mediaPlayerState->position() ); | 206 | setPosition( mediaPlayerState->position() ); |
@@ -341,7 +380,31 @@ void AudioWidget::paintButton( QPainter *p, int i ) { | |||
341 | } | 380 | } |
342 | 381 | ||
343 | 382 | ||
383 | void AudioWidget::skipFor() { | ||
384 | skipDirection = +1; | ||
385 | startTimer( 50 ); | ||
386 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); | ||
387 | } | ||
388 | |||
389 | void AudioWidget::skipBack() { | ||
390 | skipDirection = -1; | ||
391 | startTimer( 50 ); | ||
392 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); | ||
393 | } | ||
394 | |||
395 | |||
396 | |||
397 | void AudioWidget::stopSkip() { | ||
398 | killTimers(); | ||
399 | } | ||
400 | |||
401 | |||
344 | void AudioWidget::timerEvent( QTimerEvent * ) { | 402 | void AudioWidget::timerEvent( QTimerEvent * ) { |
403 | if ( skipDirection == +1 ) { | ||
404 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); | ||
405 | } else if ( skipDirection == -1 ) { | ||
406 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); | ||
407 | } | ||
345 | } | 408 | } |
346 | 409 | ||
347 | 410 | ||
@@ -363,13 +426,19 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
363 | audioButtons[i].isHeld = TRUE; | 426 | audioButtons[i].isHeld = TRUE; |
364 | toggleButton(i); | 427 | toggleButton(i); |
365 | switch (i) { | 428 | switch (i) { |
366 | case AudioVolumeUp: | 429 | case AudioVolumeUp: |
367 | qDebug("more clicked"); | 430 | qDebug("more clicked"); |
368 | emit moreClicked(); | 431 | emit moreClicked(); |
369 | return; | 432 | return; |
370 | case AudioVolumeDown: | 433 | case AudioVolumeDown: |
371 | emit lessClicked(); | 434 | emit lessClicked(); |
372 | return; | 435 | return; |
436 | case AudioForward: | ||
437 | emit forwardClicked(); | ||
438 | return; | ||
439 | case AudioBack: | ||
440 | emit backClicked(); | ||
441 | return; | ||
373 | } | 442 | } |
374 | } else if ( !isOnButton && audioButtons[i].isHeld ) { | 443 | } else if ( !isOnButton && audioButtons[i].isHeld ) { |
375 | audioButtons[i].isHeld = FALSE; | 444 | audioButtons[i].isHeld = FALSE; |
@@ -380,18 +449,20 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
380 | audioButtons[i].isHeld = FALSE; | 449 | audioButtons[i].isHeld = FALSE; |
381 | if ( !audioButtons[i].isToggle ) { | 450 | if ( !audioButtons[i].isToggle ) { |
382 | setToggleButton( i, FALSE ); | 451 | setToggleButton( i, FALSE ); |
383 | qDebug("button toggled3 %d",i); | 452 | qDebug("button toggled3 %d",i); |
384 | } | 453 | } |
385 | switch (i) { | 454 | switch (i) { |
386 | case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; | 455 | case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; |
387 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; | 456 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; |
388 | case AudioPause: mediaPlayerState->setPaused( audioButtons[i].isDown); return; | 457 | case AudioPause: mediaPlayerState->setPaused( audioButtons[i].isDown); return; |
389 | case AudioNext: mediaPlayerState->setNext(); return; | 458 | case AudioNext: mediaPlayerState->setNext(); return; |
390 | case AudioPrevious: mediaPlayerState->setPrev(); return; | 459 | case AudioPrevious: mediaPlayerState->setPrev(); return; |
391 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; | 460 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; |
392 | case AudioVolumeUp: emit moreReleased(); return; | 461 | case AudioVolumeUp: emit moreReleased(); return; |
393 | case AudioVolumeDown: emit lessReleased(); return; | 462 | case AudioVolumeDown: emit lessReleased(); return; |
394 | case AudioPlayList: mediaPlayerState->setList(); return; | 463 | case AudioPlayList: mediaPlayerState->setList(); return; |
464 | case AudioForward: emit forwardReleased(); return; | ||
465 | case AudioBack: emit backReleased(); return; | ||
395 | } | 466 | } |
396 | } | 467 | } |
397 | } | 468 | } |
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,3 +1,36 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | ||
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | ||
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | ||
7 | =. | ||
8 | .=l. | ||
9 | .>+-= | ||
10 | _;:, .> :=|. This program is free software; you can | ||
11 | .> <`_, > . <= redistribute it and/or modify it under | ||
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
13 | .="- .-=="i, .._ License as published by the Free Software | ||
14 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
15 | ._= =} : or (at your option) any later version. | ||
16 | .%`+i> _;_. | ||
17 | .i_,=:_. -<s. This program is distributed in the hope that | ||
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
19 | : .. .:, . . . without even the implied warranty of | ||
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
22 | ..}^=.= = ; Library General Public License for more | ||
23 | ++= -. .` .: details. | ||
24 | : = ...= . :.=- | ||
25 | -. .:....=;==+<; You should have received a copy of the GNU | ||
26 | -_. . . )=. = Library General Public License along with | ||
27 | -- :-=` this library; see the file COPYING.LIB. | ||
28 | If not, write to the Free Software Foundation, | ||
29 | Inc., 59 Temple Place - Suite 330, | ||
30 | Boston, MA 02111-1307, USA. | ||
31 | |||
32 | */ | ||
33 | |||
1 | #ifndef AUDIO_WIDGET_H | 34 | #ifndef AUDIO_WIDGET_H |
2 | #define AUDIO_WIDGET_H | 35 | #define AUDIO_WIDGET_H |
3 | 36 | ||
@@ -22,13 +55,12 @@ enum AudioButtons { | |||
22 | AudioVolumeUp, | 55 | AudioVolumeUp, |
23 | AudioVolumeDown, | 56 | AudioVolumeDown, |
24 | AudioLoop, | 57 | AudioLoop, |
25 | AudioPlayList | 58 | AudioPlayList, |
59 | AudioForward, | ||
60 | AudioBack | ||
26 | }; | 61 | }; |
27 | 62 | ||
28 | 63 | ||
29 | //#define USE_DBLBUF | ||
30 | |||
31 | |||
32 | class Ticker : public QFrame { | 64 | class Ticker : public QFrame { |
33 | Q_OBJECT | 65 | Q_OBJECT |
34 | 66 | ||
@@ -69,6 +101,10 @@ signals: | |||
69 | void lessClicked(); | 101 | void lessClicked(); |
70 | void moreReleased(); | 102 | void moreReleased(); |
71 | void lessReleased(); | 103 | void lessReleased(); |
104 | void forwardClicked(); | ||
105 | void backClicked(); | ||
106 | void forwardReleased(); | ||
107 | void backReleased(); | ||
72 | void sliderMoved(long); | 108 | void sliderMoved(long); |
73 | 109 | ||
74 | protected: | 110 | protected: |
@@ -83,10 +119,15 @@ protected: | |||
83 | void timerEvent( QTimerEvent *event ); | 119 | void timerEvent( QTimerEvent *event ); |
84 | void closeEvent( QCloseEvent *event ); | 120 | void closeEvent( QCloseEvent *event ); |
85 | void keyReleaseEvent( QKeyEvent *e); | 121 | void keyReleaseEvent( QKeyEvent *e); |
122 | private slots: | ||
123 | void skipFor(); | ||
124 | void skipBack(); | ||
125 | void stopSkip(); | ||
86 | private: | 126 | private: |
87 | void toggleButton( int ); | 127 | void toggleButton( int ); |
88 | void setToggleButton( int, bool ); | 128 | void setToggleButton( int, bool ); |
89 | void paintButton( QPainter *p, int i ); | 129 | void paintButton( QPainter *p, int i ); |
130 | int skipDirection; | ||
90 | QString skin; | 131 | QString skin; |
91 | QPixmap *pixBg; | 132 | QPixmap *pixBg; |
92 | QImage *imgUp; | 133 | QImage *imgUp; |
@@ -95,7 +136,7 @@ private: | |||
95 | QBitmap *masks[11]; | 136 | QBitmap *masks[11]; |
96 | QPixmap *buttonPixUp[11]; | 137 | QPixmap *buttonPixUp[11]; |
97 | QPixmap *buttonPixDown[11]; | 138 | QPixmap *buttonPixDown[11]; |
98 | 139 | ||
99 | QPixmap *pixmaps[4]; | 140 | QPixmap *pixmaps[4]; |
100 | Ticker songInfo; | 141 | Ticker songInfo; |
101 | QSlider slider; | 142 | QSlider slider; |