author | simon <simon> | 2002-12-08 21:25:20 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-08 21:25:20 (UTC) |
commit | 1e53c722a78b37a9e477ce0e181f43ae4376d106 (patch) (unidiff) | |
tree | be031258a11cff43a4df185c91be2857a678b4be | |
parent | 10cf937a493866cfa0df9569f67c8cad25c62a5b (diff) | |
download | opie-1e53c722a78b37a9e477ce0e181f43ae4376d106.zip opie-1e53c722a78b37a9e477ce0e181f43ae4376d106.tar.gz opie-1e53c722a78b37a9e477ce0e181f43ae4376d106.tar.bz2 |
- I'm re-using code from the others, so add their copyright :)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index ed5bc5a..a1b292e 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -1,61 +1,64 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> | 2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> |
3 | (C) 2002 Max Reiss <harlekin@handhelds.org> | ||
4 | (C) 2002 L. Potter <ljp@llornkcor.com> | ||
5 | (C) 2002 Holger Freyther <zecke@handhelds.org> | ||
3 | 6 | ||
4 | This library is free software; you can redistribute it and/or | 7 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 8 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 9 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 10 | version 2 of the License, or (at your option) any later version. |
8 | 11 | ||
9 | This library is distributed in the hope that it will be useful, | 12 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 15 | Library General Public License for more details. |
13 | 16 | ||
14 | You should have received a copy of the GNU Library General Public License | 17 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 18 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
18 | */ | 21 | */ |
19 | 22 | ||
20 | 23 | ||
21 | #include "mediawidget.h" | 24 | #include "mediawidget.h" |
22 | #include "playlistwidget.h" | 25 | #include "playlistwidget.h" |
23 | 26 | ||
24 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) | 27 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) |
25 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) | 28 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) |
26 | { | 29 | { |
27 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), | 30 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), |
28 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); | 31 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); |
29 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), | 32 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), |
30 | this, SLOT( setLength( long ) ) ); | 33 | this, SLOT( setLength( long ) ) ); |
31 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), | 34 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), |
32 | this, SLOT( setPlaying( bool ) ) ); | 35 | this, SLOT( setPlaying( bool ) ) ); |
33 | } | 36 | } |
34 | 37 | ||
35 | MediaWidget::~MediaWidget() | 38 | MediaWidget::~MediaWidget() |
36 | { | 39 | { |
37 | } | 40 | } |
38 | 41 | ||
39 | void MediaWidget::closeEvent( QCloseEvent * ) | 42 | void MediaWidget::closeEvent( QCloseEvent * ) |
40 | { | 43 | { |
41 | mediaPlayerState.setList(); | 44 | mediaPlayerState.setList(); |
42 | } | 45 | } |
43 | 46 | ||
44 | void MediaWidget::handleCommand( Command command, bool buttonDown ) | 47 | void MediaWidget::handleCommand( Command command, bool buttonDown ) |
45 | { | 48 | { |
46 | switch ( command ) { | 49 | switch ( command ) { |
47 | case Play: mediaPlayerState.togglePaused(); | 50 | case Play: mediaPlayerState.togglePaused(); |
48 | case Stop: mediaPlayerState.setPlaying(FALSE); return; | 51 | case Stop: mediaPlayerState.setPlaying(FALSE); return; |
49 | case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; | 52 | case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; |
50 | case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; | 53 | case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; |
51 | case Loop: mediaPlayerState.setLooping( buttonDown ); return; | 54 | case Loop: mediaPlayerState.setLooping( buttonDown ); return; |
52 | case VolumeUp: emit moreReleased(); return; | 55 | case VolumeUp: emit moreReleased(); return; |
53 | case VolumeDown: emit lessReleased(); return; | 56 | case VolumeDown: emit lessReleased(); return; |
54 | case PlayList: mediaPlayerState.setList(); return; | 57 | case PlayList: mediaPlayerState.setList(); return; |
55 | case Forward: emit forwardReleased(); return; | 58 | case Forward: emit forwardReleased(); return; |
56 | case Back: emit backReleased(); return; | 59 | case Back: emit backReleased(); return; |
57 | } | 60 | } |
58 | } | 61 | } |
59 | 62 | ||
60 | /* vim: et sw=4 ts=4 | 63 | /* vim: et sw=4 ts=4 |
61 | */ | 64 | */ |
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 8b0d48c..c81768c 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -1,66 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> | 2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> |
3 | (C) 2002 Max Reiss <harlekin@handhelds.org> | ||
4 | (C) 2002 L. Potter <ljp@llornkcor.com> | ||
5 | (C) 2002 Holger Freyther <zecke@handhelds.org> | ||
3 | 6 | ||
4 | This library is free software; you can redistribute it and/or | 7 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 8 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 9 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 10 | version 2 of the License, or (at your option) any later version. |
8 | 11 | ||
9 | This library is distributed in the hope that it will be useful, | 12 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 15 | Library General Public License for more details. |
13 | 16 | ||
14 | You should have received a copy of the GNU Library General Public License | 17 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 18 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
18 | */ | 21 | */ |
19 | 22 | ||
20 | #ifndef MEDIAWIDGET_H | 23 | #ifndef MEDIAWIDGET_H |
21 | #define MEDIAWIDGET_H | 24 | #define MEDIAWIDGET_H |
22 | 25 | ||
23 | #include <qwidget.h> | 26 | #include <qwidget.h> |
24 | 27 | ||
25 | #include "mediaplayerstate.h" | 28 | #include "mediaplayerstate.h" |
26 | #include "playlistwidget.h" | 29 | #include "playlistwidget.h" |
27 | 30 | ||
28 | #include <vector> | 31 | #include <vector> |
29 | 32 | ||
30 | class MediaWidget : public QWidget | 33 | class MediaWidget : public QWidget |
31 | { | 34 | { |
32 | Q_OBJECT | 35 | Q_OBJECT |
33 | public: | 36 | public: |
34 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; | 37 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; |
35 | 38 | ||
36 | struct Button | 39 | struct Button |
37 | { | 40 | { |
38 | Button() : isToggle( false ), isHeld( false ), isDown( false ) {} | 41 | Button() : isToggle( false ), isHeld( false ), isDown( false ) {} |
39 | 42 | ||
40 | bool isToggle : 1; | 43 | bool isToggle : 1; |
41 | bool isHeld : 1; | 44 | bool isHeld : 1; |
42 | bool isDown : 1; | 45 | bool isDown : 1; |
43 | }; | 46 | }; |
44 | typedef std::vector<Button> ButtonVector; | 47 | typedef std::vector<Button> ButtonVector; |
45 | 48 | ||
46 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); | 49 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); |
47 | virtual ~MediaWidget(); | 50 | virtual ~MediaWidget(); |
48 | 51 | ||
49 | public slots: | 52 | public slots: |
50 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; | 53 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; |
51 | virtual void setLength( long length ) = 0; | 54 | virtual void setLength( long length ) = 0; |
52 | virtual void setPlaying( bool playing ) = 0; | 55 | virtual void setPlaying( bool playing ) = 0; |
53 | 56 | ||
54 | signals: | 57 | signals: |
55 | void moreReleased(); | 58 | void moreReleased(); |
56 | void lessReleased(); | 59 | void lessReleased(); |
57 | void forwardReleased(); | 60 | void forwardReleased(); |
58 | void backReleased(); | 61 | void backReleased(); |
59 | 62 | ||
60 | protected: | 63 | protected: |
61 | virtual void closeEvent( QCloseEvent * ); | 64 | virtual void closeEvent( QCloseEvent * ); |
62 | 65 | ||
63 | void handleCommand( Command command, bool buttonDown ); | 66 | void handleCommand( Command command, bool buttonDown ); |
64 | 67 | ||
65 | MediaPlayerState &mediaPlayerState; | 68 | MediaPlayerState &mediaPlayerState; |
66 | PlayListWidget &playList; | 69 | PlayListWidget &playList; |