-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 1d18d6f..ca84019 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -7,66 +7,72 @@ | |||
7 | This library is free software; you can redistribute it and/or | 7 | This library is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU Library General Public | 8 | modify it under the terms of the GNU Library General Public |
9 | License as published by the Free Software Foundation; either | 9 | License as published by the Free Software Foundation; either |
10 | 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. |
11 | 11 | ||
12 | 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, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | Library General Public License for more details. | 15 | Library General Public License for more details. |
16 | 16 | ||
17 | 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 |
18 | 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 |
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | 23 | ||
24 | #include "mediawidget.h" | 24 | #include "mediawidget.h" |
25 | #include "playlistwidget.h" | 25 | #include "playlistwidget.h" |
26 | 26 | ||
27 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) | 27 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) |
28 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) | 28 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) |
29 | { | 29 | { |
30 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), | 30 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), |
31 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); | 31 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); |
32 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), | 32 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), |
33 | this, SLOT( setLength( long ) ) ); | 33 | this, SLOT( setLength( long ) ) ); |
34 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), | 34 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), |
35 | this, SLOT( setPlaying( bool ) ) ); | 35 | this, SLOT( setPlaying( bool ) ) ); |
36 | } | 36 | } |
37 | 37 | ||
38 | MediaWidget::~MediaWidget() | 38 | MediaWidget::~MediaWidget() |
39 | { | 39 | { |
40 | } | 40 | } |
41 | 41 | ||
42 | void MediaWidget::closeEvent( QCloseEvent * ) | 42 | void MediaWidget::closeEvent( QCloseEvent * ) |
43 | { | 43 | { |
44 | mediaPlayerState.setList(); | 44 | mediaPlayerState.setList(); |
45 | } | 45 | } |
46 | 46 | ||
47 | void MediaWidget::handleCommand( Command command, bool buttonDown ) | 47 | void MediaWidget::handleCommand( Command command, bool buttonDown ) |
48 | { | 48 | { |
49 | switch ( command ) { | 49 | switch ( command ) { |
50 | case Play: mediaPlayerState.togglePaused(); | 50 | case Play: mediaPlayerState.togglePaused(); |
51 | case Stop: mediaPlayerState.setPlaying(FALSE); return; | 51 | case Stop: mediaPlayerState.setPlaying(FALSE); return; |
52 | case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; | 52 | case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; |
53 | case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; | 53 | case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; |
54 | case Loop: mediaPlayerState.setLooping( buttonDown ); return; | 54 | case Loop: mediaPlayerState.setLooping( buttonDown ); return; |
55 | case VolumeUp: emit moreReleased(); return; | 55 | case VolumeUp: emit moreReleased(); return; |
56 | case VolumeDown: emit lessReleased(); return; | 56 | case VolumeDown: emit lessReleased(); return; |
57 | case PlayList: mediaPlayerState.setList(); return; | 57 | case PlayList: mediaPlayerState.setList(); return; |
58 | case Forward: emit forwardReleased(); return; | 58 | case Forward: emit forwardReleased(); return; |
59 | case Back: emit backReleased(); return; | 59 | case Back: emit backReleased(); return; |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const | 63 | bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const |
64 | { | 64 | { |
65 | return ( position.x() > 0 && position.y() > 0 && | 65 | return ( position.x() > 0 && position.y() > 0 && |
66 | position.x() < buttonMask.width() && | 66 | position.x() < buttonMask.width() && |
67 | position.y() < buttonMask.height() && | 67 | position.y() < buttonMask.height() && |
68 | buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 ); | 68 | buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 ); |
69 | } | 69 | } |
70 | 70 | ||
71 | void MediaWidget::repaintButton( int buttonId ) | ||
72 | { | ||
73 | QPainter p( this ); | ||
74 | paintButton( p, buttonId ); | ||
75 | } | ||
76 | |||
71 | /* vim: et sw=4 ts=4 | 77 | /* vim: et sw=4 ts=4 |
72 | */ | 78 | */ |