-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 46e7b6e..3953d92 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -1,90 +1,92 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (C) 2002 Simon Hausmann <simon@lst.de> | 2 | Copyright (C) 2002 Simon Hausmann <simon@lst.de> |
3 | (C) 2002 Max Reiss <harlekin@handhelds.org> | 3 | (C) 2002 Max Reiss <harlekin@handhelds.org> |
4 | (C) 2002 L. Potter <ljp@llornkcor.com> | 4 | (C) 2002 L. Potter <ljp@llornkcor.com> |
5 | (C) 2002 Holger Freyther <zecke@handhelds.org> | 5 | (C) 2002 Holger Freyther <zecke@handhelds.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or | 7 | This program is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU General Public | 8 | modify it under the terms of the GNU 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 program is distributed in the hope that it will be useful, | 12 | This program 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 | General Public License for more details. | 15 | General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; see the file COPYING. If not, write to | 18 | along with this program; see the file COPYING. 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 | #include "mediawidget.h" | 23 | #include "mediawidget.h" |
24 | #include "playlistwidget.h" | 24 | #include "playlistwidget.h" |
25 | #include "skin.h" | 25 | #include "skin.h" |
26 | 26 | ||
27 | #include <assert.h> | ||
28 | |||
27 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) | 29 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) |
28 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) | 30 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) |
29 | { | 31 | { |
30 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), | 32 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), |
31 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); | 33 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); |
32 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), | 34 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), |
33 | this, SLOT( setLength( long ) ) ); | 35 | this, SLOT( setLength( long ) ) ); |
34 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), | 36 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), |
35 | this, SLOT( setPlaying( bool ) ) ); | 37 | this, SLOT( setPlaying( bool ) ) ); |
36 | 38 | ||
37 | setBackgroundMode( NoBackground ); | 39 | setBackgroundMode( NoBackground ); |
38 | } | 40 | } |
39 | 41 | ||
40 | MediaWidget::~MediaWidget() | 42 | MediaWidget::~MediaWidget() |
41 | { | 43 | { |
42 | } | 44 | } |
43 | 45 | ||
44 | void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, | 46 | void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, |
45 | const Skin &skin ) | 47 | const Skin &skin ) |
46 | { | 48 | { |
47 | buttonMask = skin.buttonMask( skinInfo, buttonCount ); | 49 | buttonMask = skin.buttonMask( skinInfo, buttonCount ); |
48 | 50 | ||
49 | buttons.clear(); | 51 | buttons.clear(); |
50 | buttons.reserve( buttonCount ); | 52 | buttons.reserve( buttonCount ); |
51 | 53 | ||
52 | for ( uint i = 0; i < buttonCount; ++i ) { | 54 | for ( uint i = 0; i < buttonCount; ++i ) { |
53 | Button button = setupButton( skinInfo[ i ], skin ); | 55 | Button button = setupButton( skinInfo[ i ], skin ); |
54 | buttons.push_back( button ); | 56 | buttons.push_back( button ); |
55 | } | 57 | } |
56 | } | 58 | } |
57 | 59 | ||
58 | MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) | 60 | MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) |
59 | { | 61 | { |
60 | Button button; | 62 | Button button; |
61 | button.command = buttonInfo.command; | 63 | button.command = buttonInfo.command; |
62 | button.type = buttonInfo.type; | 64 | button.type = buttonInfo.type; |
63 | button.mask = skin.buttonMaskImage( buttonInfo.fileName ); | 65 | button.mask = skin.buttonMaskImage( buttonInfo.fileName ); |
64 | 66 | ||
65 | return button; | 67 | return button; |
66 | } | 68 | } |
67 | 69 | ||
68 | void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo ) | 70 | void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo ) |
69 | { | 71 | { |
70 | Skin skin( guiInfo.fileNameInfix ); | 72 | Skin skin( guiInfo.fileNameInfix ); |
71 | skin.setCachable( false ); | 73 | skin.setCachable( false ); |
72 | loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin ); | 74 | loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin ); |
73 | } | 75 | } |
74 | 76 | ||
75 | void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) | 77 | void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) |
76 | { | 78 | { |
77 | backgroundPixmap = skin.backgroundPixmap(); | 79 | backgroundPixmap = skin.backgroundPixmap(); |
78 | buttonUpImage = skin.buttonUpImage(); | 80 | buttonUpImage = skin.buttonUpImage(); |
79 | buttonDownImage = skin.buttonDownImage(); | 81 | buttonDownImage = skin.buttonDownImage(); |
80 | 82 | ||
81 | setupButtons( skinInfo, buttonCount, skin ); | 83 | setupButtons( skinInfo, buttonCount, skin ); |
82 | } | 84 | } |
83 | 85 | ||
84 | void MediaWidget::closeEvent( QCloseEvent * ) | 86 | void MediaWidget::closeEvent( QCloseEvent * ) |
85 | { | 87 | { |
86 | mediaPlayerState.setList(); | 88 | mediaPlayerState.setList(); |
87 | } | 89 | } |
88 | 90 | ||
89 | void MediaWidget::paintEvent( QPaintEvent *pe ) | 91 | void MediaWidget::paintEvent( QPaintEvent *pe ) |
90 | { | 92 | { |