author | simon <simon> | 2002-12-11 13:06:35 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-11 13:06:35 (UTC) |
commit | 84d92e2298605f4d4f9a9209731f62c2b10e54e4 (patch) (unidiff) | |
tree | 9742dc8490da1a2ff1b2af2484fc87b1f218ca36 | |
parent | aa9623e53bd86c2645103ebacc81262f372b73d7 (diff) | |
download | opie-84d92e2298605f4d4f9a9209731f62c2b10e54e4.zip opie-84d92e2298605f4d4f9a9209731f62c2b10e54e4.tar.gz opie-84d92e2298605f4d4f9a9209731f62c2b10e54e4.tar.bz2 |
- minor cleanup
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 2 |
2 files changed, 5 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 6b304ec..0d1c8b6 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -1,179 +1,177 @@ | |||
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> | 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 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 | #include "skin.h" | 26 | #include "skin.h" |
27 | 27 | ||
28 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
29 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
30 | 30 | ||
31 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) | 31 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) |
32 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) | 32 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) |
33 | { | 33 | { |
34 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), | 34 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), |
35 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); | 35 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); |
36 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), | 36 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), |
37 | this, SLOT( setLength( long ) ) ); | 37 | this, SLOT( setLength( long ) ) ); |
38 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), | 38 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), |
39 | this, SLOT( setPlaying( bool ) ) ); | 39 | this, SLOT( setPlaying( bool ) ) ); |
40 | } | 40 | } |
41 | 41 | ||
42 | MediaWidget::~MediaWidget() | 42 | MediaWidget::~MediaWidget() |
43 | { | 43 | { |
44 | } | 44 | } |
45 | 45 | ||
46 | void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, | 46 | void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, |
47 | const Skin &skin ) | 47 | const Skin &skin ) |
48 | { | 48 | { |
49 | buttonMask = skin.buttonMask( skinInfo, buttonCount ); | 49 | buttonMask = skin.buttonMask( skinInfo, buttonCount ); |
50 | 50 | ||
51 | buttons.clear(); | 51 | buttons.clear(); |
52 | buttons.reserve( buttonCount ); | 52 | buttons.reserve( buttonCount ); |
53 | 53 | ||
54 | for ( uint i = 0; i < buttonCount; ++i ) { | 54 | for ( uint i = 0; i < buttonCount; ++i ) { |
55 | Button button = setupButton( skinInfo[ i ], skin ); | 55 | Button button = setupButton( skinInfo[ i ], skin ); |
56 | buttons.push_back( button ); | 56 | buttons.push_back( button ); |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) | 60 | MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) |
61 | { | 61 | { |
62 | Button button; | 62 | Button button; |
63 | button.command = buttonInfo.command; | 63 | button.command = buttonInfo.command; |
64 | button.type = buttonInfo.type; | 64 | button.type = buttonInfo.type; |
65 | button.mask = skin.buttonMaskImage( buttonInfo.fileName ); | 65 | button.mask = skin.buttonMaskImage( buttonInfo.fileName ); |
66 | 66 | ||
67 | return button; | 67 | return button; |
68 | } | 68 | } |
69 | 69 | ||
70 | void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix ) | 70 | void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix ) |
71 | { | 71 | { |
72 | Config cfg( "OpiePlayer" ); | 72 | Config cfg( "OpiePlayer" ); |
73 | cfg.setGroup( "Options" ); | 73 | cfg.setGroup( "Options" ); |
74 | QString skin = cfg.readEntry( "Skin","default" ); | 74 | QString name = cfg.readEntry( "Skin","default" ); |
75 | 75 | ||
76 | loadSkin( skinInfo, buttonCount, skin, fileNameInfix ); | 76 | Skin skin( name, fileNameInfix ); |
77 | loadSkin( skinInfo, buttonCount, skin ); | ||
77 | } | 78 | } |
78 | 79 | ||
79 | void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix ) | 80 | void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) |
80 | { | 81 | { |
81 | Skin skin( name, fileNameInfix ); | ||
82 | |||
83 | QString skinPath = "opieplayer2/skins/" + name; | ||
84 | backgroundPixmap = skin.backgroundImage(); | 82 | backgroundPixmap = skin.backgroundImage(); |
85 | buttonUpImage = skin.buttonUpImage(); | 83 | buttonUpImage = skin.buttonUpImage(); |
86 | buttonDownImage = skin.buttonDownImage(); | 84 | buttonDownImage = skin.buttonDownImage(); |
87 | 85 | ||
88 | setupButtons( skinInfo, buttonCount, skin ); | 86 | setupButtons( skinInfo, buttonCount, skin ); |
89 | } | 87 | } |
90 | 88 | ||
91 | void MediaWidget::closeEvent( QCloseEvent * ) | 89 | void MediaWidget::closeEvent( QCloseEvent * ) |
92 | { | 90 | { |
93 | mediaPlayerState.setList(); | 91 | mediaPlayerState.setList(); |
94 | } | 92 | } |
95 | 93 | ||
96 | void MediaWidget::paintEvent( QPaintEvent *pe ) | 94 | void MediaWidget::paintEvent( QPaintEvent *pe ) |
97 | { | 95 | { |
98 | QPainter p( this ); | 96 | QPainter p( this ); |
99 | 97 | ||
100 | if ( mediaPlayerState.isFullscreen() ) { | 98 | if ( mediaPlayerState.isFullscreen() ) { |
101 | // Clear the background | 99 | // Clear the background |
102 | p.setBrush( QBrush( Qt::black ) ); | 100 | p.setBrush( QBrush( Qt::black ) ); |
103 | return; | 101 | return; |
104 | } | 102 | } |
105 | 103 | ||
106 | if ( !pe->erased() ) { | 104 | if ( !pe->erased() ) { |
107 | // Combine with background and double buffer | 105 | // Combine with background and double buffer |
108 | QPixmap pix( pe->rect().size() ); | 106 | QPixmap pix( pe->rect().size() ); |
109 | QPainter p( &pix ); | 107 | QPainter p( &pix ); |
110 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 108 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
111 | p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() ); | 109 | p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() ); |
112 | paintAllButtons( p ); | 110 | paintAllButtons( p ); |
113 | QPainter p2( this ); | 111 | QPainter p2( this ); |
114 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 112 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
115 | } else { | 113 | } else { |
116 | QPainter p( this ); | 114 | QPainter p( this ); |
117 | paintAllButtons( p ); | 115 | paintAllButtons( p ); |
118 | } | 116 | } |
119 | } | 117 | } |
120 | 118 | ||
121 | MediaWidget::Button *MediaWidget::buttonAt( const QPoint &position ) | 119 | MediaWidget::Button *MediaWidget::buttonAt( const QPoint &position ) |
122 | { | 120 | { |
123 | if ( position.x() <= 0 || position.y() <= 0 || | 121 | if ( position.x() <= 0 || position.y() <= 0 || |
124 | position.x() >= buttonMask.width() || | 122 | position.x() >= buttonMask.width() || |
125 | position.y() >= buttonMask.height() ) | 123 | position.y() >= buttonMask.height() ) |
126 | return 0; | 124 | return 0; |
127 | 125 | ||
128 | int pixelIdx = buttonMask.pixelIndex( position.x(), position.y() ); | 126 | int pixelIdx = buttonMask.pixelIndex( position.x(), position.y() ); |
129 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) | 127 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) |
130 | if ( it->command + 1 == pixelIdx ) | 128 | if ( it->command + 1 == pixelIdx ) |
131 | return &( *it ); | 129 | return &( *it ); |
132 | 130 | ||
133 | return 0; | 131 | return 0; |
134 | } | 132 | } |
135 | 133 | ||
136 | void MediaWidget::mousePressEvent( QMouseEvent *event ) | 134 | void MediaWidget::mousePressEvent( QMouseEvent *event ) |
137 | { | 135 | { |
138 | Button *button = buttonAt( event->pos() - upperLeftOfButtonMask ); | 136 | Button *button = buttonAt( event->pos() - upperLeftOfButtonMask ); |
139 | 137 | ||
140 | if ( !button ) { | 138 | if ( !button ) { |
141 | QWidget::mousePressEvent( event ); | 139 | QWidget::mousePressEvent( event ); |
142 | return; | 140 | return; |
143 | } | 141 | } |
144 | 142 | ||
145 | switch ( button->command ) { | 143 | switch ( button->command ) { |
146 | case VolumeUp: emit moreClicked(); return; | 144 | case VolumeUp: emit moreClicked(); return; |
147 | case VolumeDown: emit lessClicked(); return; | 145 | case VolumeDown: emit lessClicked(); return; |
148 | case Back: emit backClicked(); return; | 146 | case Back: emit backClicked(); return; |
149 | case Forward: emit forwardClicked(); return; | 147 | case Forward: emit forwardClicked(); return; |
150 | default: break; | 148 | default: break; |
151 | } | 149 | } |
152 | } | 150 | } |
153 | 151 | ||
154 | void MediaWidget::mouseReleaseEvent( QMouseEvent *event ) | 152 | void MediaWidget::mouseReleaseEvent( QMouseEvent *event ) |
155 | { | 153 | { |
156 | Button *button = buttonAt( event->pos() - upperLeftOfButtonMask ); | 154 | Button *button = buttonAt( event->pos() - upperLeftOfButtonMask ); |
157 | 155 | ||
158 | if ( !button ) { | 156 | if ( !button ) { |
159 | QWidget::mouseReleaseEvent( event ); | 157 | QWidget::mouseReleaseEvent( event ); |
160 | return; | 158 | return; |
161 | } | 159 | } |
162 | 160 | ||
163 | if ( button->type == ToggleButton ) | 161 | if ( button->type == ToggleButton ) |
164 | toggleButton( *button ); | 162 | toggleButton( *button ); |
165 | 163 | ||
166 | handleCommand( button->command, button->isDown ); | 164 | handleCommand( button->command, button->isDown ); |
167 | } | 165 | } |
168 | 166 | ||
169 | void MediaWidget::makeVisible() | 167 | void MediaWidget::makeVisible() |
170 | { | 168 | { |
171 | } | 169 | } |
172 | 170 | ||
173 | void MediaWidget::handleCommand( Command command, bool buttonDown ) | 171 | void MediaWidget::handleCommand( Command command, bool buttonDown ) |
174 | { | 172 | { |
175 | switch ( command ) { | 173 | switch ( command ) { |
176 | case Play: mediaPlayerState.togglePaused(); return; | 174 | case Play: mediaPlayerState.togglePaused(); return; |
177 | case Stop: mediaPlayerState.setPlaying(FALSE); return; | 175 | case Stop: mediaPlayerState.setPlaying(FALSE); return; |
178 | case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; | 176 | case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; |
179 | case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; | 177 | case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; |
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 0fe4772..9f13677 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -13,138 +13,138 @@ | |||
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 | #ifndef MEDIAWIDGET_H | 23 | #ifndef MEDIAWIDGET_H |
24 | #define MEDIAWIDGET_H | 24 | #define MEDIAWIDGET_H |
25 | 25 | ||
26 | #include <qwidget.h> | 26 | #include <qwidget.h> |
27 | #include <qmap.h> | 27 | #include <qmap.h> |
28 | 28 | ||
29 | #include "mediaplayerstate.h" | 29 | #include "mediaplayerstate.h" |
30 | #include "playlistwidget.h" | 30 | #include "playlistwidget.h" |
31 | 31 | ||
32 | #include <vector> | 32 | #include <vector> |
33 | #include <memory> | 33 | #include <memory> |
34 | 34 | ||
35 | namespace | 35 | namespace |
36 | { | 36 | { |
37 | struct simpleAndStupidAllocator | 37 | struct simpleAndStupidAllocator |
38 | { | 38 | { |
39 | static void *allocate( size_t amount ) | 39 | static void *allocate( size_t amount ) |
40 | { return ::operator new( amount ); } | 40 | { return ::operator new( amount ); } |
41 | static void deallocate( void *p, size_t ) | 41 | static void deallocate( void *p, size_t ) |
42 | { ::operator delete( p ); } | 42 | { ::operator delete( p ); } |
43 | }; | 43 | }; |
44 | } | 44 | } |
45 | 45 | ||
46 | class Skin; | 46 | class Skin; |
47 | 47 | ||
48 | class MediaWidget : public QWidget | 48 | class MediaWidget : public QWidget |
49 | { | 49 | { |
50 | Q_OBJECT | 50 | Q_OBJECT |
51 | public: | 51 | public: |
52 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined }; | 52 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined }; |
53 | enum ButtonType { NormalButton, ToggleButton }; | 53 | enum ButtonType { NormalButton, ToggleButton }; |
54 | 54 | ||
55 | struct Button | 55 | struct Button |
56 | { | 56 | { |
57 | Button() : command( Undefined ), type( NormalButton ), isDown( false ) {} | 57 | Button() : command( Undefined ), type( NormalButton ), isDown( false ) {} |
58 | 58 | ||
59 | Command command; | 59 | Command command; |
60 | 60 | ||
61 | ButtonType type; // this should be part of the bitfield but gcc2 is too buggy to support this :-( | 61 | ButtonType type; // this should be part of the bitfield but gcc2 is too buggy to support this :-( |
62 | bool isDown : 1; | 62 | bool isDown : 1; |
63 | 63 | ||
64 | QBitmap mask; | 64 | QBitmap mask; |
65 | QPixmap pixUp; | 65 | QPixmap pixUp; |
66 | QPixmap pixDown; | 66 | QPixmap pixDown; |
67 | }; | 67 | }; |
68 | #if defined( _CC_GNU_ ) | 68 | #if defined( _CC_GNU_ ) |
69 | // use that allocator to avoid the default allocator that on gcc2 requires libstdc++ because | 69 | // use that allocator to avoid the default allocator that on gcc2 requires libstdc++ because |
70 | // in the BAD_ALLOC macro it uses std::cerr and friends :-( | 70 | // in the BAD_ALLOC macro it uses std::cerr and friends :-( |
71 | typedef std::vector<Button, std::__allocator<Button, simpleAndStupidAllocator> > ButtonVector; | 71 | typedef std::vector<Button, std::__allocator<Button, simpleAndStupidAllocator> > ButtonVector; |
72 | #else | 72 | #else |
73 | typedef std::vector<Button> ButtonVector; | 73 | typedef std::vector<Button> ButtonVector; |
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | struct SkinButtonInfo | 76 | struct SkinButtonInfo |
77 | { | 77 | { |
78 | Command command; | 78 | Command command; |
79 | const char *fileName; | 79 | const char *fileName; |
80 | ButtonType type; | 80 | ButtonType type; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); | 83 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); |
84 | virtual ~MediaWidget(); | 84 | virtual ~MediaWidget(); |
85 | 85 | ||
86 | public slots: | 86 | public slots: |
87 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; | 87 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; |
88 | virtual void setLength( long length ) = 0; | 88 | virtual void setLength( long length ) = 0; |
89 | virtual void setPlaying( bool playing ) = 0; | 89 | virtual void setPlaying( bool playing ) = 0; |
90 | 90 | ||
91 | virtual void loadSkin() = 0; | 91 | virtual void loadSkin() = 0; |
92 | 92 | ||
93 | signals: | 93 | signals: |
94 | void moreReleased(); | 94 | void moreReleased(); |
95 | void lessReleased(); | 95 | void lessReleased(); |
96 | void forwardReleased(); | 96 | void forwardReleased(); |
97 | void backReleased(); | 97 | void backReleased(); |
98 | void forwardClicked(); | 98 | void forwardClicked(); |
99 | void backClicked(); | 99 | void backClicked(); |
100 | void moreClicked(); | 100 | void moreClicked(); |
101 | void lessClicked(); | 101 | void lessClicked(); |
102 | 102 | ||
103 | protected: | 103 | protected: |
104 | void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, | 104 | void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, |
105 | const Skin &skin ); | 105 | const Skin &skin ); |
106 | Button setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ); | 106 | Button setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ); |
107 | 107 | ||
108 | void loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix = QString::null ); | 108 | void loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix = QString::null ); |
109 | void loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix ); | 109 | void loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ); |
110 | 110 | ||
111 | virtual void closeEvent( QCloseEvent * ); | 111 | virtual void closeEvent( QCloseEvent * ); |
112 | 112 | ||
113 | virtual void paintEvent( QPaintEvent *pe ); | 113 | virtual void paintEvent( QPaintEvent *pe ); |
114 | 114 | ||
115 | Button *buttonAt( const QPoint &position ); | 115 | Button *buttonAt( const QPoint &position ); |
116 | 116 | ||
117 | virtual void mousePressEvent( QMouseEvent *event ); | 117 | virtual void mousePressEvent( QMouseEvent *event ); |
118 | virtual void mouseReleaseEvent( QMouseEvent *event ); | 118 | virtual void mouseReleaseEvent( QMouseEvent *event ); |
119 | 119 | ||
120 | virtual void makeVisible(); | 120 | virtual void makeVisible(); |
121 | 121 | ||
122 | void handleCommand( Command command, bool buttonDown ); | 122 | void handleCommand( Command command, bool buttonDown ); |
123 | 123 | ||
124 | bool isOverButton( const QPoint &position, int buttonId ) const; | 124 | bool isOverButton( const QPoint &position, int buttonId ) const; |
125 | 125 | ||
126 | void paintAllButtons( QPainter &p ); | 126 | void paintAllButtons( QPainter &p ); |
127 | void paintButton( const Button &button ); | 127 | void paintButton( const Button &button ); |
128 | void paintButton( QPainter &p, const Button &button ); | 128 | void paintButton( QPainter &p, const Button &button ); |
129 | 129 | ||
130 | void setToggleButton( Button &button, bool down ); | 130 | void setToggleButton( Button &button, bool down ); |
131 | void setToggleButton( Command command, bool down ); | 131 | void setToggleButton( Command command, bool down ); |
132 | void toggleButton( Button &button ); | 132 | void toggleButton( Button &button ); |
133 | 133 | ||
134 | MediaPlayerState &mediaPlayerState; | 134 | MediaPlayerState &mediaPlayerState; |
135 | PlayListWidget &playList; | 135 | PlayListWidget &playList; |
136 | 136 | ||
137 | ButtonVector buttons; | 137 | ButtonVector buttons; |
138 | 138 | ||
139 | QImage buttonMask; | 139 | QImage buttonMask; |
140 | 140 | ||
141 | QPoint upperLeftOfButtonMask; | 141 | QPoint upperLeftOfButtonMask; |
142 | 142 | ||
143 | QPixmap backgroundPixmap; | 143 | QPixmap backgroundPixmap; |
144 | QImage buttonUpImage; | 144 | QImage buttonUpImage; |
145 | QImage buttonDownImage; | 145 | QImage buttonDownImage; |
146 | }; | 146 | }; |
147 | 147 | ||
148 | #endif // MEDIAWIDGET_H | 148 | #endif // MEDIAWIDGET_H |
149 | /* vim: et sw=4 ts=4 | 149 | /* vim: et sw=4 ts=4 |
150 | */ | 150 | */ |