author | simon <simon> | 2002-12-08 21:13:27 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-08 21:13:27 (UTC) |
commit | b3ae76e6afdfd734789a85c5e80e8e846b15d6cf (patch) (unidiff) | |
tree | 5ac754c7945fc89f3cfc70e361fe109ba1c90233 | |
parent | 009f786417b304168f2e23ddd1d8626653ba1c63 (diff) | |
download | opie-b3ae76e6afdfd734789a85c5e80e8e846b15d6cf.zip opie-b3ae76e6afdfd734789a85c5e80e8e846b15d6cf.tar.gz opie-b3ae76e6afdfd734789a85c5e80e8e846b15d6cf.tar.bz2 |
- made videoButtons a member variable instead of a global one
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 7 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 25 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 2 |
3 files changed, 29 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 0b9d826..9cb75ae 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -1,68 +1,73 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> | 2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | 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 | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef MEDIAWIDGET_H | 20 | #ifndef MEDIAWIDGET_H |
21 | #define MEDIAWIDGET_H | 21 | #define MEDIAWIDGET_H |
22 | 22 | ||
23 | #include <qwidget.h> | 23 | #include <qwidget.h> |
24 | 24 | ||
25 | #include "mediaplayerstate.h" | 25 | #include "mediaplayerstate.h" |
26 | #include "playlistwidget.h" | 26 | #include "playlistwidget.h" |
27 | 27 | ||
28 | #include <vector> | ||
29 | |||
28 | class MediaWidget : public QWidget | 30 | class MediaWidget : public QWidget |
29 | { | 31 | { |
30 | Q_OBJECT | 32 | Q_OBJECT |
31 | public: | 33 | public: |
32 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; | 34 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; |
33 | 35 | ||
34 | struct Button | 36 | struct Button |
35 | { | 37 | { |
36 | // Button() : isToggle( false ), isHeld( false ), isDown( false ) {} | 38 | //Button() : isToggle( false ), isHeld( false ), isDown( false ) {} |
39 | // Button( bool toggle, bool held, bool down ) | ||
40 | // : isToggle( toggle ), isHeld( held ), isDown( down ) {} | ||
37 | 41 | ||
38 | bool isToggle : 1; | 42 | bool isToggle : 1; |
39 | bool isHeld : 1; | 43 | bool isHeld : 1; |
40 | bool isDown : 1; | 44 | bool isDown : 1; |
41 | }; | 45 | }; |
46 | typedef std::vector<Button> ButtonVector; | ||
42 | 47 | ||
43 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); | 48 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); |
44 | virtual ~MediaWidget(); | 49 | virtual ~MediaWidget(); |
45 | 50 | ||
46 | public slots: | 51 | public slots: |
47 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; | 52 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; |
48 | virtual void setLength( long length ) = 0; | 53 | virtual void setLength( long length ) = 0; |
49 | virtual void setPlaying( bool playing ) = 0; | 54 | virtual void setPlaying( bool playing ) = 0; |
50 | 55 | ||
51 | signals: | 56 | signals: |
52 | void moreReleased(); | 57 | void moreReleased(); |
53 | void lessReleased(); | 58 | void lessReleased(); |
54 | void forwardReleased(); | 59 | void forwardReleased(); |
55 | void backReleased(); | 60 | void backReleased(); |
56 | 61 | ||
57 | protected: | 62 | protected: |
58 | virtual void closeEvent( QCloseEvent * ); | 63 | virtual void closeEvent( QCloseEvent * ); |
59 | 64 | ||
60 | void handleCommand( Command command, bool buttonDown ); | 65 | void handleCommand( Command command, bool buttonDown ); |
61 | 66 | ||
62 | MediaPlayerState &mediaPlayerState; | 67 | MediaPlayerState &mediaPlayerState; |
63 | PlayListWidget &playList; | 68 | PlayListWidget &playList; |
64 | }; | 69 | }; |
65 | 70 | ||
66 | #endif // MEDIAWIDGET_H | 71 | #endif // MEDIAWIDGET_H |
67 | /* vim: et sw=4 ts=4 | 72 | /* vim: et sw=4 ts=4 |
68 | */ | 73 | */ |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 7c20c6d..efd756c 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -30,87 +30,104 @@ | |||
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <qpe/qpeapplication.h> | 34 | #include <qpe/qpeapplication.h> |
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | 37 | ||
38 | 38 | ||
39 | #include <qwidget.h> | 39 | #include <qwidget.h> |
40 | #include <qpainter.h> | 40 | #include <qpainter.h> |
41 | #include <qpixmap.h> | 41 | #include <qpixmap.h> |
42 | #include <qslider.h> | 42 | #include <qslider.h> |
43 | #include <qdrawutil.h> | 43 | #include <qdrawutil.h> |
44 | #include "videowidget.h" | 44 | #include "videowidget.h" |
45 | #include "mediaplayerstate.h" | 45 | #include "mediaplayerstate.h" |
46 | #include "playlistwidget.h" | 46 | #include "playlistwidget.h" |
47 | 47 | ||
48 | 48 | ||
49 | #ifdef Q_WS_QWS | 49 | #ifdef Q_WS_QWS |
50 | # define USE_DIRECT_PAINTER | 50 | # define USE_DIRECT_PAINTER |
51 | # include <qdirectpainter_qws.h> | 51 | # include <qdirectpainter_qws.h> |
52 | # include <qgfxraster_qws.h> | 52 | # include <qgfxraster_qws.h> |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | 55 | ||
56 | namespace | 56 | namespace |
57 | { | 57 | { |
58 | 58 | ||
59 | const int xo = 2; // movable x offset | 59 | const int xo = 2; // movable x offset |
60 | const int yo = 0; // movable y offset | 60 | const int yo = 0; // movable y offset |
61 | 61 | ||
62 | /* | ||
62 | MediaWidget::Button videoButtons[] = { | 63 | MediaWidget::Button videoButtons[] = { |
63 | { FALSE, FALSE, FALSE }, // stop | 64 | { FALSE, FALSE, FALSE }, // stop |
64 | { TRUE, FALSE, FALSE }, // play | 65 | { TRUE, FALSE, FALSE }, // play |
65 | { FALSE, FALSE, FALSE }, // previous | 66 | { FALSE, FALSE, FALSE }, // previous |
66 | { FALSE, FALSE, FALSE }, // next | 67 | { FALSE, FALSE, FALSE }, // next |
67 | { FALSE, FALSE, FALSE }, // volUp | 68 | { FALSE, FALSE, FALSE }, // volUp |
68 | { FALSE, FALSE, FALSE }, // volDown | 69 | { FALSE, FALSE, FALSE }, // volDown |
69 | { TRUE, FALSE, FALSE } // fullscreen | 70 | { TRUE, FALSE, FALSE } // fullscreen |
70 | }; | 71 | }; |
72 | */ | ||
71 | 73 | ||
72 | const char * const skinV_mask_file_names[7] = { | 74 | const char * const skinV_mask_file_names[7] = { |
73 | "stop","play","back","fwd","up","down","full" | 75 | "stop","play","back","fwd","up","down","full" |
74 | }; | 76 | }; |
75 | 77 | ||
76 | const int numVButtons = (sizeof(videoButtons)/sizeof(MediaWidget::Button)); | 78 | //const int numVButtons = (sizeof(videoButtons)/sizeof(MediaWidget::Button)); |
77 | 79 | ||
78 | } | 80 | } |
79 | 81 | ||
80 | VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) | 82 | VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) |
81 | : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) | 83 | : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) |
82 | { | 84 | { |
83 | setCaption( tr("OpiePlayer - Video") ); | 85 | setCaption( tr("OpiePlayer - Video") ); |
84 | 86 | ||
87 | Button defaultButton; | ||
88 | defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; | ||
89 | Button toggleButton; | ||
90 | toggleButton.isToggle = true; | ||
91 | toggleButton.isHeld = toggleButton.isDown = false; | ||
92 | |||
93 | videoButtons.reserve( 7 ); | ||
94 | videoButtons.push_back( defaultButton ); // stop | ||
95 | videoButtons.push_back( toggleButton ); // play | ||
96 | videoButtons.push_back( defaultButton ); // previous | ||
97 | videoButtons.push_back( defaultButton ); // next | ||
98 | videoButtons.push_back( defaultButton ); // volUp | ||
99 | videoButtons.push_back( defaultButton ); // volDown | ||
100 | videoButtons.push_back( toggleButton ); //fullscreen | ||
101 | |||
85 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 102 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
86 | 103 | ||
87 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 104 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
88 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); | 105 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); |
89 | 106 | ||
90 | Config cfg("OpiePlayer"); | 107 | Config cfg("OpiePlayer"); |
91 | cfg.setGroup("Options"); | 108 | cfg.setGroup("Options"); |
92 | skin = cfg.readEntry("Skin","default"); | 109 | skin = cfg.readEntry("Skin","default"); |
93 | 110 | ||
94 | QString skinPath = "opieplayer2/skins/" + skin; | 111 | QString skinPath = "opieplayer2/skins/" + skin; |
95 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 112 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
96 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 113 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
97 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 114 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
98 | 115 | ||
99 | imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); | 116 | imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); |
100 | imgButtonMask.fill( 0 ); | 117 | imgButtonMask.fill( 0 ); |
101 | 118 | ||
102 | for ( int i = 0; i < 7; i++ ) { | 119 | for ( int i = 0; i < 7; i++ ) { |
103 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); | 120 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); |
104 | masks[i] = new QBitmap( filename ); | 121 | masks[i] = new QBitmap( filename ); |
105 | 122 | ||
106 | if ( !masks[i]->isNull() ) { | 123 | if ( !masks[i]->isNull() ) { |
107 | QImage imgMask = masks[i]->convertToImage(); | 124 | QImage imgMask = masks[i]->convertToImage(); |
108 | uchar **dest = imgButtonMask.jumpTable(); | 125 | uchar **dest = imgButtonMask.jumpTable(); |
109 | for ( int y = 0; y < imgUp.height(); y++ ) { | 126 | for ( int y = 0; y < imgUp.height(); y++ ) { |
110 | uchar *line = dest[y]; | 127 | uchar *line = dest[y]; |
111 | for ( int x = 0; x < imgUp.width(); x++ ) { | 128 | for ( int x = 0; x < imgUp.width(); x++ ) { |
112 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 129 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
113 | line[x] = i + 1; | 130 | line[x] = i + 1; |
114 | } | 131 | } |
115 | } | 132 | } |
116 | } | 133 | } |
@@ -247,65 +264,65 @@ void VideoWidget::updateSlider( long i, long max ) { | |||
247 | if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { | 264 | if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { |
248 | if ( slider->value() != val ) { | 265 | if ( slider->value() != val ) { |
249 | slider->setValue( val ); | 266 | slider->setValue( val ); |
250 | } | 267 | } |
251 | if ( slider->maxValue() != width ) { | 268 | if ( slider->maxValue() != width ) { |
252 | slider->setMaxValue( width ); | 269 | slider->setMaxValue( width ); |
253 | } | 270 | } |
254 | } | 271 | } |
255 | } | 272 | } |
256 | 273 | ||
257 | void VideoWidget::setToggleButton( int i, bool down ) { | 274 | void VideoWidget::setToggleButton( int i, bool down ) { |
258 | if ( down != videoButtons[i].isDown ) { | 275 | if ( down != videoButtons[i].isDown ) { |
259 | toggleButton( i ); | 276 | toggleButton( i ); |
260 | } | 277 | } |
261 | } | 278 | } |
262 | 279 | ||
263 | void VideoWidget::toggleButton( int i ) { | 280 | void VideoWidget::toggleButton( int i ) { |
264 | videoButtons[i].isDown = !videoButtons[i].isDown; | 281 | videoButtons[i].isDown = !videoButtons[i].isDown; |
265 | QPainter p(this); | 282 | QPainter p(this); |
266 | paintButton ( &p, i ); | 283 | paintButton ( &p, i ); |
267 | } | 284 | } |
268 | 285 | ||
269 | void VideoWidget::paintButton( QPainter *p, int i ) { | 286 | void VideoWidget::paintButton( QPainter *p, int i ) { |
270 | 287 | ||
271 | if ( videoButtons[i].isDown ) { | 288 | if ( videoButtons[i].isDown ) { |
272 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 289 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
273 | } else { | 290 | } else { |
274 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 291 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
275 | } | 292 | } |
276 | } | 293 | } |
277 | 294 | ||
278 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 295 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
279 | for ( int i = 0; i < numVButtons; i++ ) { | 296 | for ( unsigned int i = 0; i < videoButtons.size(); i++ ) { |
280 | if ( event->state() == QMouseEvent::LeftButton ) { | 297 | if ( event->state() == QMouseEvent::LeftButton ) { |
281 | // The test to see if the mouse click is inside the button or not | 298 | // The test to see if the mouse click is inside the button or not |
282 | int x = event->pos().x() - xoff; | 299 | int x = event->pos().x() - xoff; |
283 | int y = event->pos().y() - yoff; | 300 | int y = event->pos().y() - yoff; |
284 | 301 | ||
285 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width() | 302 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width() |
286 | && y < imgButtonMask.height() | 303 | && y < imgButtonMask.height() |
287 | && imgButtonMask.pixelIndex( x, y ) == i + 1 ); | 304 | && imgButtonMask.pixelIndex( x, y ) == i + 1 ); |
288 | 305 | ||
289 | if ( isOnButton && !videoButtons[i].isHeld ) { | 306 | if ( isOnButton && !videoButtons[i].isHeld ) { |
290 | videoButtons[i].isHeld = TRUE; | 307 | videoButtons[i].isHeld = TRUE; |
291 | toggleButton(i); | 308 | toggleButton(i); |
292 | 309 | ||
293 | switch (i) { | 310 | switch (i) { |
294 | case VideoVolUp: | 311 | case VideoVolUp: |
295 | emit moreClicked(); | 312 | emit moreClicked(); |
296 | return; | 313 | return; |
297 | case VideoVolDown: | 314 | case VideoVolDown: |
298 | emit lessClicked(); | 315 | emit lessClicked(); |
299 | return; | 316 | return; |
300 | } | 317 | } |
301 | } else if ( !isOnButton && videoButtons[i].isHeld ) { | 318 | } else if ( !isOnButton && videoButtons[i].isHeld ) { |
302 | videoButtons[i].isHeld = FALSE; | 319 | videoButtons[i].isHeld = FALSE; |
303 | toggleButton(i); | 320 | toggleButton(i); |
304 | } | 321 | } |
305 | } else { | 322 | } else { |
306 | 323 | ||
307 | if ( videoButtons[i].isHeld ) { | 324 | if ( videoButtons[i].isHeld ) { |
308 | videoButtons[i].isHeld = FALSE; | 325 | videoButtons[i].isHeld = FALSE; |
309 | if ( !videoButtons[i].isToggle ) { | 326 | if ( !videoButtons[i].isToggle ) { |
310 | setToggleButton( i, FALSE ); | 327 | setToggleButton( i, FALSE ); |
311 | } | 328 | } |
@@ -394,72 +411,72 @@ void VideoWidget::makeVisible() { | |||
394 | slider->hide(); | 411 | slider->hide(); |
395 | } | 412 | } |
396 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 413 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
397 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 414 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
398 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 415 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
399 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 416 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
400 | } else { | 417 | } else { |
401 | slider->show(); | 418 | slider->show(); |
402 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 419 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
403 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 420 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
404 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 421 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
405 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 422 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
406 | } | 423 | } |
407 | } | 424 | } |
408 | } | 425 | } |
409 | 426 | ||
410 | 427 | ||
411 | 428 | ||
412 | 429 | ||
413 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 430 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
414 | QPainter p( this ); | 431 | QPainter p( this ); |
415 | 432 | ||
416 | if ( mediaPlayerState.isFullscreen() ) { | 433 | if ( mediaPlayerState.isFullscreen() ) { |
417 | // Clear the background | 434 | // Clear the background |
418 | p.setBrush( QBrush( Qt::black ) ); | 435 | p.setBrush( QBrush( Qt::black ) ); |
419 | } else { | 436 | } else { |
420 | if ( !pe->erased() ) { | 437 | if ( !pe->erased() ) { |
421 | // Combine with background and double buffer | 438 | // Combine with background and double buffer |
422 | QPixmap pix( pe->rect().size() ); | 439 | QPixmap pix( pe->rect().size() ); |
423 | QPainter p( &pix ); | 440 | QPainter p( &pix ); |
424 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 441 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
425 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 442 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); |
426 | for ( int i = 0; i < numVButtons; i++ ) { | 443 | for ( unsigned int i = 0; i < videoButtons.size(); i++ ) { |
427 | paintButton( &p, i ); | 444 | paintButton( &p, i ); |
428 | } | 445 | } |
429 | QPainter p2( this ); | 446 | QPainter p2( this ); |
430 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 447 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
431 | } else { | 448 | } else { |
432 | QPainter p( this ); | 449 | QPainter p( this ); |
433 | for ( int i = 0; i < numVButtons; i++ ) | 450 | for ( unsigned int i = 0; i < videoButtons.size(); i++ ) |
434 | paintButton( &p, i ); | 451 | paintButton( &p, i ); |
435 | } | 452 | } |
436 | //slider->repaint( TRUE ); | 453 | //slider->repaint( TRUE ); |
437 | } | 454 | } |
438 | } | 455 | } |
439 | 456 | ||
440 | 457 | ||
441 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 458 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
442 | switch ( e->key() ) { | 459 | switch ( e->key() ) { |
443 | ////////////////////////////// Zaurus keys | 460 | ////////////////////////////// Zaurus keys |
444 | case Key_Home: | 461 | case Key_Home: |
445 | break; | 462 | break; |
446 | case Key_F9: //activity | 463 | case Key_F9: //activity |
447 | break; | 464 | break; |
448 | case Key_F10: //contacts | 465 | case Key_F10: //contacts |
449 | // hide(); | 466 | // hide(); |
450 | break; | 467 | break; |
451 | case Key_F11: //menu | 468 | case Key_F11: //menu |
452 | break; | 469 | break; |
453 | case Key_F12: //home | 470 | case Key_F12: //home |
454 | break; | 471 | break; |
455 | case Key_F13: //mail | 472 | case Key_F13: //mail |
456 | break; | 473 | break; |
457 | case Key_Space: { | 474 | case Key_Space: { |
458 | if(mediaPlayerState.isPlaying()) { | 475 | if(mediaPlayerState.isPlaying()) { |
459 | mediaPlayerState.setPlaying(FALSE); | 476 | mediaPlayerState.setPlaying(FALSE); |
460 | } else { | 477 | } else { |
461 | mediaPlayerState.setPlaying(TRUE); | 478 | mediaPlayerState.setPlaying(TRUE); |
462 | } | 479 | } |
463 | } | 480 | } |
464 | break; | 481 | break; |
465 | case Key_Down: | 482 | case Key_Down: |
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index f996803..34558f8 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -91,38 +91,40 @@ protected: | |||
91 | void paintEvent( QPaintEvent *pe ); | 91 | void paintEvent( QPaintEvent *pe ); |
92 | void showEvent( QShowEvent *se ); | 92 | void showEvent( QShowEvent *se ); |
93 | void mouseMoveEvent( QMouseEvent *event ); | 93 | void mouseMoveEvent( QMouseEvent *event ); |
94 | void mousePressEvent( QMouseEvent *event ); | 94 | void mousePressEvent( QMouseEvent *event ); |
95 | void mouseReleaseEvent( QMouseEvent *event ); | 95 | void mouseReleaseEvent( QMouseEvent *event ); |
96 | void keyReleaseEvent( QKeyEvent *e); | 96 | void keyReleaseEvent( QKeyEvent *e); |
97 | 97 | ||
98 | private: | 98 | private: |
99 | // Ticker songInfo; | 99 | // Ticker songInfo; |
100 | QPixmap pixBg; | 100 | QPixmap pixBg; |
101 | QImage imgUp; | 101 | QImage imgUp; |
102 | QImage imgDn; | 102 | QImage imgDn; |
103 | QImage imgButtonMask; | 103 | QImage imgButtonMask; |
104 | QBitmap *masks[7]; | 104 | QBitmap *masks[7]; |
105 | QPixmap *buttonPixUp[7]; | 105 | QPixmap *buttonPixUp[7]; |
106 | QPixmap *buttonPixDown[7]; | 106 | QPixmap *buttonPixDown[7]; |
107 | QString skin; | 107 | QString skin; |
108 | // QPixmap *pixmaps[4]; | 108 | // QPixmap *pixmaps[4]; |
109 | int xoff, yoff; | 109 | int xoff, yoff; |
110 | 110 | ||
111 | 111 | ||
112 | void paintButton( QPainter *p, int i ); | 112 | void paintButton( QPainter *p, int i ); |
113 | void toggleButton( int ); | 113 | void toggleButton( int ); |
114 | void setToggleButton( int, bool ); | 114 | void setToggleButton( int, bool ); |
115 | 115 | ||
116 | QString backgroundPix; | 116 | QString backgroundPix; |
117 | QSlider *slider; | 117 | QSlider *slider; |
118 | QPixmap *pixmaps[3]; | 118 | QPixmap *pixmaps[3]; |
119 | QImage *currentFrame; | 119 | QImage *currentFrame; |
120 | int scaledWidth; | 120 | int scaledWidth; |
121 | int scaledHeight; | 121 | int scaledHeight; |
122 | XineVideoWidget* videoFrame; | 122 | XineVideoWidget* videoFrame; |
123 | |||
124 | ButtonVector videoButtons; | ||
123 | }; | 125 | }; |
124 | 126 | ||
125 | #endif // VIDEO_WIDGET_H | 127 | #endif // VIDEO_WIDGET_H |
126 | 128 | ||
127 | 129 | ||
128 | 130 | ||