author | zecke <zecke> | 2004-09-23 21:38:02 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-09-23 21:38:02 (UTC) |
commit | 97ab73d99688443d02086b4f00d1de7c81faa3c7 (patch) (unidiff) | |
tree | 63864e847abc41442d2ed88ca27a27ad1942c15a /noncore/multimedia/opieplayer2/mediawidget.cpp | |
parent | 3080b2095fd9dddc4937cbf74037ce1dbc7fa6b2 (diff) | |
download | opie-97ab73d99688443d02086b4f00d1de7c81faa3c7.zip opie-97ab73d99688443d02086b4f00d1de7c81faa3c7.tar.gz opie-97ab73d99688443d02086b4f00d1de7c81faa3c7.tar.bz2 |
-Remove bogus whitespaces
-Remove stl dependency
-Make switching from fullscreen video to audio work
-Remove debug output
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediawidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 563ccf5..880b295 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -45,17 +45,16 @@ MediaWidget::~MediaWidget() | |||
45 | void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, | 45 | void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, |
46 | const Skin &skin ) | 46 | const Skin &skin ) |
47 | { | 47 | { |
48 | buttonMask = skin.buttonMask( skinInfo, buttonCount ); | 48 | buttonMask = skin.buttonMask( skinInfo, buttonCount ); |
49 | 49 | ||
50 | buttons.clear(); | 50 | buttons.clear(); |
51 | buttons.reserve( buttonCount ); | ||
52 | 51 | ||
53 | for ( uint i = 0; i < buttonCount; ++i ) { | 52 | for ( uint i = 0; i < buttonCount; ++i ) { |
54 | Button button = setupButton( skinInfo[ i ], skin ); | 53 | Button button = setupButton( skinInfo[ i ], skin ); |
55 | buttons.push_back( button ); | 54 | buttons.append( button ); |
56 | } | 55 | } |
57 | } | 56 | } |
58 | 57 | ||
59 | MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) | 58 | MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) |
60 | { | 59 | { |
61 | Button button; | 60 | Button button; |
@@ -84,35 +83,29 @@ void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, co | |||
84 | 83 | ||
85 | void MediaWidget::closeEvent( QCloseEvent * ) | 84 | void MediaWidget::closeEvent( QCloseEvent * ) |
86 | { | 85 | { |
87 | mediaPlayerState.setList(); | 86 | mediaPlayerState.setList(); |
88 | } | 87 | } |
89 | 88 | ||
90 | void MediaWidget::paintEvent( QPaintEvent *pe ) | 89 | void MediaWidget::paintEvent( QPaintEvent * ) |
91 | { | 90 | { |
92 | QPainter p( this ); | 91 | QPainter p( this ); |
93 | 92 | ||
94 | if ( mediaPlayerState.isFullscreen() ) { | ||
95 | // Clear the background | ||
96 | p.setBrush( QBrush( Qt::black ) ); | ||
97 | return; | ||
98 | } | ||
99 | |||
100 | QPixmap buffer( size() ); | 93 | QPixmap buffer( size() ); |
101 | QPainter bufferedPainter( &buffer ); | 94 | QPainter bufferedPainter( &buffer ); |
102 | bufferedPainter.drawTiledPixmap( rect(), backgroundPixmap, QPoint( 0, 0 ) ); | 95 | bufferedPainter.drawTiledPixmap( rect(), backgroundPixmap, QPoint( 0, 0 ) ); |
103 | paintAllButtons( bufferedPainter ); | 96 | paintAllButtons( bufferedPainter ); |
104 | p.drawPixmap( 0, 0, buffer ); | 97 | p.drawPixmap( 0, 0, buffer ); |
105 | } | 98 | } |
106 | 99 | ||
107 | void MediaWidget::resizeEvent( QResizeEvent *e ) | 100 | void MediaWidget::resizeEvent( QResizeEvent *e ) |
108 | { | 101 | { |
109 | QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, upperLeftOfButtonMask ); | 102 | QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, upperLeftOfButtonMask ); |
110 | QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, upperLeftOfButtonMask ); | 103 | QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, upperLeftOfButtonMask ); |
111 | 104 | ||
112 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { | 105 | for ( ButtonVector::Iterator it = buttons.begin(); it != buttons.end(); ++it ) { |
113 | Button &button = *it; | 106 | Button &button = *it; |
114 | 107 | ||
115 | if ( button.mask.isNull() ) | 108 | if ( button.mask.isNull() ) |
116 | continue; | 109 | continue; |
117 | button.pixUp = addMaskToPixmap( pixUp, button.mask ); | 110 | button.pixUp = addMaskToPixmap( pixUp, button.mask ); |
118 | button.pixDown = addMaskToPixmap( pixDn, button.mask ); | 111 | button.pixDown = addMaskToPixmap( pixDn, button.mask ); |
@@ -126,14 +119,14 @@ MediaWidget::Button *MediaWidget::buttonAt( const QPoint &position ) | |||
126 | if ( position.x() <= 0 || position.y() <= 0 || | 119 | if ( position.x() <= 0 || position.y() <= 0 || |
127 | position.x() >= buttonMask.width() || | 120 | position.x() >= buttonMask.width() || |
128 | position.y() >= buttonMask.height() ) | 121 | position.y() >= buttonMask.height() ) |
129 | return 0; | 122 | return 0; |
130 | 123 | ||
131 | int pixelIdx = buttonMask.pixelIndex( position.x(), position.y() ); | 124 | int pixelIdx = buttonMask.pixelIndex( position.x(), position.y() ); |
132 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) | 125 | for ( ButtonVector::Iterator it = buttons.begin(); it != buttons.end(); ++it ) |
133 | if ( it->command + 1 == pixelIdx ) | 126 | if ( (*it).command + 1 == pixelIdx ) |
134 | return &( *it ); | 127 | return &( *it ); |
135 | 128 | ||
136 | return 0; | 129 | return 0; |
137 | } | 130 | } |
138 | 131 | ||
139 | void MediaWidget::mousePressEvent( QMouseEvent *event ) | 132 | void MediaWidget::mousePressEvent( QMouseEvent *event ) |
@@ -190,21 +183,21 @@ void MediaWidget::handleCommand( Command command, bool buttonDown ) | |||
190 | default: assert( false ); | 183 | default: assert( false ); |
191 | } | 184 | } |
192 | } | 185 | } |
193 | 186 | ||
194 | bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const | 187 | bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const |
195 | { | 188 | { |
196 | return ( position.x() > 0 && position.y() > 0 && | 189 | return ( position.x() > 0 && position.y() > 0 && |
197 | position.x() < buttonMask.width() && | 190 | position.x() < buttonMask.width() && |
198 | position.y() < buttonMask.height() && | 191 | position.y() < buttonMask.height() && |
199 | buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 ); | 192 | buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 ); |
200 | } | 193 | } |
201 | 194 | ||
202 | void MediaWidget::paintAllButtons( QPainter &p ) | 195 | void MediaWidget::paintAllButtons( QPainter &p ) |
203 | { | 196 | { |
204 | for ( ButtonVector::const_iterator it = buttons.begin(); | 197 | for ( ButtonVector::ConstIterator it = buttons.begin(); |
205 | it != buttons.end(); ++it ) | 198 | it != buttons.end(); ++it ) |
206 | paintButton( p, *it ); | 199 | paintButton( p, *it ); |
207 | } | 200 | } |
208 | 201 | ||
209 | void MediaWidget::paintButton( const Button &button ) | 202 | void MediaWidget::paintButton( const Button &button ) |
210 | { | 203 | { |
@@ -219,14 +212,14 @@ void MediaWidget::paintButton( QPainter &p, const Button &button ) | |||
219 | else | 212 | else |
220 | p.drawPixmap( upperLeftOfButtonMask, button.pixUp ); | 213 | p.drawPixmap( upperLeftOfButtonMask, button.pixUp ); |
221 | } | 214 | } |
222 | 215 | ||
223 | void MediaWidget::setToggleButton( Command command, bool down ) | 216 | void MediaWidget::setToggleButton( Command command, bool down ) |
224 | { | 217 | { |
225 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) | 218 | for ( ButtonVector::Iterator it = buttons.begin(); it != buttons.end(); ++it ) |
226 | if ( it->command == command ) { | 219 | if ( (*it).command == command ) { |
227 | setToggleButton( *it, down ); | 220 | setToggleButton( *it, down ); |
228 | return; | 221 | return; |
229 | } | 222 | } |
230 | } | 223 | } |
231 | 224 | ||
232 | void MediaWidget::setToggleButton( Button &button, bool down ) | 225 | void MediaWidget::setToggleButton( Button &button, bool down ) |