author | simon <simon> | 2002-12-09 14:48:13 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 14:48:13 (UTC) |
commit | 9ab8a657b23fd1871c4a376fdd097732c14392e0 (patch) (unidiff) | |
tree | 5e507bf74fad84ae6da1ed1facc689fd89de167d | |
parent | 174c4a427750a3829ffd81a87454be8abf61ee30 (diff) | |
download | opie-9ab8a657b23fd1871c4a376fdd097732c14392e0.zip opie-9ab8a657b23fd1871c4a376fdd097732c14392e0.tar.gz opie-9ab8a657b23fd1871c4a376fdd097732c14392e0.tar.bz2 |
- migrating from a button vector to a button map
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 21 |
3 files changed, 18 insertions, 17 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index c148820..12f91a9 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -107,33 +107,33 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
107 | button.type = skinInfo[ i ].type; | 107 | button.type = skinInfo[ i ].type; |
108 | 108 | ||
109 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skinInfo[i].fileName + ".png" ); | 109 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skinInfo[i].fileName + ".png" ); |
110 | button.mask =QBitmap( filename ); | 110 | button.mask =QBitmap( filename ); |
111 | 111 | ||
112 | if ( !button.mask.isNull() ) { | 112 | if ( !button.mask.isNull() ) { |
113 | QImage imgMask = button.mask.convertToImage(); | 113 | QImage imgMask = button.mask.convertToImage(); |
114 | uchar **dest = buttonMask.jumpTable(); | 114 | uchar **dest = buttonMask.jumpTable(); |
115 | for ( int y = 0; y < imgUp.height(); y++ ) { | 115 | for ( int y = 0; y < imgUp.height(); y++ ) { |
116 | uchar *line = dest[y]; | 116 | uchar *line = dest[y]; |
117 | for ( int x = 0; x < imgUp.width(); x++ ) | 117 | for ( int x = 0; x < imgUp.width(); x++ ) |
118 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 118 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
119 | line[x] = i + 1; | 119 | line[x] = i + 1; |
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | buttons.push_back( button ); | 123 | buttons.insert( i, button ); |
124 | } | 124 | } |
125 | 125 | ||
126 | setBackgroundPixmap( pixBg ); | 126 | setBackgroundPixmap( pixBg ); |
127 | 127 | ||
128 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 128 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
129 | // changeTextColor( &songInfo ); | 129 | // changeTextColor( &songInfo ); |
130 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | 130 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); |
131 | // songInfo.setFrameStyle( QFrame::NoFrame); | 131 | // songInfo.setFrameStyle( QFrame::NoFrame); |
132 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | 132 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); |
133 | // songInfo.setForegroundColor(Qt::white); | 133 | // songInfo.setForegroundColor(Qt::white); |
134 | 134 | ||
135 | slider.setFixedHeight( 20 ); | 135 | slider.setFixedHeight( 20 ); |
136 | slider.setMinValue( 0 ); | 136 | slider.setMinValue( 0 ); |
137 | slider.setMaxValue( 1 ); | 137 | slider.setMaxValue( 1 ); |
138 | slider.setFocusPolicy( QWidget::NoFocus ); | 138 | slider.setFocusPolicy( QWidget::NoFocus ); |
139 | slider.setBackgroundPixmap( pixBg ); | 139 | slider.setBackgroundPixmap( pixBg ); |
@@ -195,33 +195,33 @@ void AudioWidget::resizeEvent( QResizeEvent * ) { | |||
195 | int h = height(); | 195 | int h = height(); |
196 | int w = width(); | 196 | int w = width(); |
197 | 197 | ||
198 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); | 198 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); |
199 | slider.setFixedWidth( w - 110 ); | 199 | slider.setFixedWidth( w - 110 ); |
200 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 200 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
201 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); | 201 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); |
202 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | 202 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); |
203 | 203 | ||
204 | upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; | 204 | upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; |
205 | upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; | 205 | upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; |
206 | QPoint p = upperLeftOfButtonMask; | 206 | QPoint p = upperLeftOfButtonMask; |
207 | 207 | ||
208 | QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); | 208 | QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); |
209 | QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); | 209 | QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); |
210 | 210 | ||
211 | for ( uint i = 0; i < buttons.size(); i++ ) { | 211 | for ( uint i = 0; i < buttons.count(); i++ ) { |
212 | if ( !buttons[i].mask.isNull() ) { | 212 | if ( !buttons[i].mask.isNull() ) { |
213 | buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask ); | 213 | buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask ); |
214 | buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask ); | 214 | buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask ); |
215 | } | 215 | } |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | void AudioWidget::sliderPressed() { | 219 | void AudioWidget::sliderPressed() { |
220 | audioSliderBeingMoved = TRUE; | 220 | audioSliderBeingMoved = TRUE; |
221 | } | 221 | } |
222 | 222 | ||
223 | 223 | ||
224 | void AudioWidget::sliderReleased() { | 224 | void AudioWidget::sliderReleased() { |
225 | audioSliderBeingMoved = FALSE; | 225 | audioSliderBeingMoved = FALSE; |
226 | if ( slider.width() == 0 ) | 226 | if ( slider.width() == 0 ) |
227 | return; | 227 | return; |
@@ -338,33 +338,33 @@ void AudioWidget::skipBack() { | |||
338 | 338 | ||
339 | void AudioWidget::stopSkip() { | 339 | void AudioWidget::stopSkip() { |
340 | killTimers(); | 340 | killTimers(); |
341 | } | 341 | } |
342 | 342 | ||
343 | 343 | ||
344 | void AudioWidget::timerEvent( QTimerEvent * ) { | 344 | void AudioWidget::timerEvent( QTimerEvent * ) { |
345 | if ( skipDirection == +1 ) { | 345 | if ( skipDirection == +1 ) { |
346 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); | 346 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); |
347 | } else if ( skipDirection == -1 ) { | 347 | } else if ( skipDirection == -1 ) { |
348 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); | 348 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); |
349 | } | 349 | } |
350 | } | 350 | } |
351 | 351 | ||
352 | 352 | ||
353 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 353 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
354 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { | 354 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { |
355 | if ( event->state() == QMouseEvent::LeftButton ) { | 355 | if ( event->state() == QMouseEvent::LeftButton ) { |
356 | // The test to see if the mouse click is inside the button or not | 356 | // The test to see if the mouse click is inside the button or not |
357 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); | 357 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); |
358 | 358 | ||
359 | if ( isOnButton && !buttons[i].isHeld ) { | 359 | if ( isOnButton && !buttons[i].isHeld ) { |
360 | buttons[i].isHeld = TRUE; | 360 | buttons[i].isHeld = TRUE; |
361 | toggleButton(i); | 361 | toggleButton(i); |
362 | switch (i) { | 362 | switch (i) { |
363 | case VolumeUp: | 363 | case VolumeUp: |
364 | emit moreClicked(); | 364 | emit moreClicked(); |
365 | return; | 365 | return; |
366 | case VolumeDown: | 366 | case VolumeDown: |
367 | emit lessClicked(); | 367 | emit lessClicked(); |
368 | return; | 368 | return; |
369 | case Forward: | 369 | case Forward: |
370 | emit forwardClicked(); | 370 | emit forwardClicked(); |
@@ -401,39 +401,39 @@ void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { | |||
401 | } | 401 | } |
402 | 402 | ||
403 | 403 | ||
404 | void AudioWidget::showEvent( QShowEvent* ) { | 404 | void AudioWidget::showEvent( QShowEvent* ) { |
405 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 405 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
406 | mouseMoveEvent( &event ); | 406 | mouseMoveEvent( &event ); |
407 | } | 407 | } |
408 | 408 | ||
409 | 409 | ||
410 | void AudioWidget::paintEvent( QPaintEvent * pe ) { | 410 | void AudioWidget::paintEvent( QPaintEvent * pe ) { |
411 | if ( !pe->erased() ) { | 411 | if ( !pe->erased() ) { |
412 | // Combine with background and double buffer | 412 | // Combine with background and double buffer |
413 | QPixmap pix( pe->rect().size() ); | 413 | QPixmap pix( pe->rect().size() ); |
414 | QPainter p( &pix ); | 414 | QPainter p( &pix ); |
415 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 415 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
416 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 416 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); |
417 | for ( unsigned int i = 0; i < buttons.size(); i++ ) | 417 | for ( unsigned int i = 0; i < buttons.count(); i++ ) |
418 | paintButton( p, i ); | 418 | paintButton( p, i ); |
419 | QPainter p2( this ); | 419 | QPainter p2( this ); |
420 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 420 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
421 | } else { | 421 | } else { |
422 | QPainter p( this ); | 422 | QPainter p( this ); |
423 | for ( unsigned int i = 0; i < buttons.size(); i++ ) | 423 | for ( unsigned int i = 0; i < buttons.count(); i++ ) |
424 | paintButton( p, i ); | 424 | paintButton( p, i ); |
425 | } | 425 | } |
426 | } | 426 | } |
427 | 427 | ||
428 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { | 428 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { |
429 | switch ( e->key() ) { | 429 | switch ( e->key() ) { |
430 | ////////////////////////////// Zaurus keys | 430 | ////////////////////////////// Zaurus keys |
431 | case Key_Home: | 431 | case Key_Home: |
432 | break; | 432 | break; |
433 | case Key_F9: //activity | 433 | case Key_F9: //activity |
434 | hide(); | 434 | hide(); |
435 | // qDebug("Audio F9"); | 435 | // qDebug("Audio F9"); |
436 | break; | 436 | break; |
437 | case Key_F10: //contacts | 437 | case Key_F10: //contacts |
438 | break; | 438 | break; |
439 | case Key_F11: //menu | 439 | case Key_F11: //menu |
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 504b705..49bf024 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -38,32 +38,34 @@ public: | |||
38 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; | 38 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; |
39 | enum ButtonType { NormalButton, ToggleButton }; | 39 | enum ButtonType { NormalButton, ToggleButton }; |
40 | 40 | ||
41 | struct Button | 41 | struct Button |
42 | { | 42 | { |
43 | Button() : type( NormalButton ), isHeld( false ), isDown( false ) {} | 43 | Button() : type( NormalButton ), isHeld( false ), isDown( false ) {} |
44 | 44 | ||
45 | ButtonType type : 1; | 45 | ButtonType type : 1; |
46 | bool isHeld : 1; | 46 | bool isHeld : 1; |
47 | bool isDown : 1; | 47 | bool isDown : 1; |
48 | 48 | ||
49 | QBitmap mask; | 49 | QBitmap mask; |
50 | QPixmap pixUp; | 50 | QPixmap pixUp; |
51 | QPixmap pixDown; | 51 | QPixmap pixDown; |
52 | }; | 52 | }; |
53 | typedef std::vector<Button> ButtonVector; | 53 | typedef std::vector<Button> ButtonVector; |
54 | // when the transition is done this should be Command -> Button | ||
55 | typedef QMap<int, Button> ButtonMap; | ||
54 | 56 | ||
55 | struct SkinButtonInfo | 57 | struct SkinButtonInfo |
56 | { | 58 | { |
57 | Command command; | 59 | Command command; |
58 | const char *fileName; | 60 | const char *fileName; |
59 | ButtonType type; | 61 | ButtonType type; |
60 | }; | 62 | }; |
61 | 63 | ||
62 | typedef std::vector<QBitmap> MaskVector; | 64 | typedef std::vector<QBitmap> MaskVector; |
63 | typedef std::vector<QPixmap> PixmapVector; | 65 | typedef std::vector<QPixmap> PixmapVector; |
64 | 66 | ||
65 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); | 67 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); |
66 | virtual ~MediaWidget(); | 68 | virtual ~MediaWidget(); |
67 | 69 | ||
68 | public slots: | 70 | public slots: |
69 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; | 71 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; |
@@ -78,26 +80,26 @@ signals: | |||
78 | 80 | ||
79 | protected: | 81 | protected: |
80 | virtual void closeEvent( QCloseEvent * ); | 82 | virtual void closeEvent( QCloseEvent * ); |
81 | 83 | ||
82 | void handleCommand( Command command, bool buttonDown ); | 84 | void handleCommand( Command command, bool buttonDown ); |
83 | 85 | ||
84 | bool isOverButton( const QPoint &position, int buttonId ) const; | 86 | bool isOverButton( const QPoint &position, int buttonId ) const; |
85 | 87 | ||
86 | void paintButton( int buttonId ); | 88 | void paintButton( int buttonId ); |
87 | virtual void paintButton( QPainter &p, int i ) = 0; | 89 | virtual void paintButton( QPainter &p, int i ) = 0; |
88 | 90 | ||
89 | void toggleButton( int buttonId ); | 91 | void toggleButton( int buttonId ); |
90 | 92 | ||
91 | MediaPlayerState &mediaPlayerState; | 93 | MediaPlayerState &mediaPlayerState; |
92 | PlayListWidget &playList; | 94 | PlayListWidget &playList; |
93 | 95 | ||
94 | ButtonVector buttons; | 96 | ButtonMap buttons; |
95 | 97 | ||
96 | QImage buttonMask; | 98 | QImage buttonMask; |
97 | 99 | ||
98 | QPoint upperLeftOfButtonMask; | 100 | QPoint upperLeftOfButtonMask; |
99 | }; | 101 | }; |
100 | 102 | ||
101 | #endif // MEDIAWIDGET_H | 103 | #endif // MEDIAWIDGET_H |
102 | /* vim: et sw=4 ts=4 | 104 | /* vim: et sw=4 ts=4 |
103 | */ | 105 | */ |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 380c703..7d85d63 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -61,40 +61,39 @@ const int yo = 0; // movable y offset | |||
61 | 61 | ||
62 | const char * const skinV_mask_file_names[7] = { | 62 | const char * const skinV_mask_file_names[7] = { |
63 | "play","stop","fwd","back","up","down","full" | 63 | "play","stop","fwd","back","up","down","full" |
64 | }; | 64 | }; |
65 | 65 | ||
66 | } | 66 | } |
67 | 67 | ||
68 | VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) | 68 | VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) |
69 | : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) | 69 | : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) |
70 | { | 70 | { |
71 | setCaption( tr("OpiePlayer - Video") ); | 71 | setCaption( tr("OpiePlayer - Video") ); |
72 | 72 | ||
73 | Button defaultButton; | 73 | Button defaultButton; |
74 | Button toggleButton = defaultButton; | 74 | Button toggleButton = defaultButton; |
75 | toggleButton.type = ToggleButton; | 75 | toggleButton.type = ToggleButton; |
76 | 76 | ||
77 | buttons.reserve( 7 ); | 77 | buttons.insert( 0, toggleButton ); // play |
78 | buttons.push_back( toggleButton ); // play | 78 | buttons.insert( 1, toggleButton ); // stop |
79 | buttons.push_back( defaultButton ); // stop | 79 | buttons.insert( 2, toggleButton ); // next |
80 | buttons.push_back( defaultButton ); // next | 80 | buttons.insert( 3, toggleButton ); // previous |
81 | buttons.push_back( defaultButton ); // previous | 81 | buttons.insert( 4, toggleButton ); // volUp |
82 | buttons.push_back( defaultButton ); // volUp | 82 | buttons.insert( 5, toggleButton ); // volDown |
83 | buttons.push_back( defaultButton ); // volDown | 83 | buttons.insert( 6, toggleButton ); // fullscreen |
84 | buttons.push_back( toggleButton ); //fullscreen | ||
85 | 84 | ||
86 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 85 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
87 | 86 | ||
88 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 87 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
89 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); | 88 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); |
90 | 89 | ||
91 | Config cfg("OpiePlayer"); | 90 | Config cfg("OpiePlayer"); |
92 | cfg.setGroup("Options"); | 91 | cfg.setGroup("Options"); |
93 | skin = cfg.readEntry("Skin","default"); | 92 | skin = cfg.readEntry("Skin","default"); |
94 | 93 | ||
95 | QString skinPath = "opieplayer2/skins/" + skin; | 94 | QString skinPath = "opieplayer2/skins/" + skin; |
96 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 95 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
97 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 96 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
98 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 97 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
99 | 98 | ||
100 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); | 99 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); |
@@ -258,33 +257,33 @@ void VideoWidget::updateSlider( long i, long max ) { | |||
258 | void VideoWidget::setToggleButton( int i, bool down ) { | 257 | void VideoWidget::setToggleButton( int i, bool down ) { |
259 | if ( down != buttons[i].isDown ) { | 258 | if ( down != buttons[i].isDown ) { |
260 | toggleButton( i ); | 259 | toggleButton( i ); |
261 | } | 260 | } |
262 | } | 261 | } |
263 | 262 | ||
264 | void VideoWidget::paintButton( QPainter &p, int i ) { | 263 | void VideoWidget::paintButton( QPainter &p, int i ) { |
265 | 264 | ||
266 | if ( buttons[i].isDown ) { | 265 | if ( buttons[i].isDown ) { |
267 | p.drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] ); | 266 | p.drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] ); |
268 | } else { | 267 | } else { |
269 | p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] ); | 268 | p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] ); |
270 | } | 269 | } |
271 | } | 270 | } |
272 | 271 | ||
273 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 272 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
274 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { | 273 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { |
275 | if ( event->state() == QMouseEvent::LeftButton ) { | 274 | if ( event->state() == QMouseEvent::LeftButton ) { |
276 | // The test to see if the mouse click is inside the button or not | 275 | // The test to see if the mouse click is inside the button or not |
277 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); | 276 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); |
278 | 277 | ||
279 | if ( isOnButton && !buttons[i].isHeld ) { | 278 | if ( isOnButton && !buttons[i].isHeld ) { |
280 | buttons[i].isHeld = TRUE; | 279 | buttons[i].isHeld = TRUE; |
281 | toggleButton(i); | 280 | toggleButton(i); |
282 | 281 | ||
283 | switch (i) { | 282 | switch (i) { |
284 | case VideoVolUp: | 283 | case VideoVolUp: |
285 | emit moreClicked(); | 284 | emit moreClicked(); |
286 | return; | 285 | return; |
287 | case VideoVolDown: | 286 | case VideoVolDown: |
288 | emit lessClicked(); | 287 | emit lessClicked(); |
289 | return; | 288 | return; |
290 | } | 289 | } |
@@ -400,40 +399,40 @@ void VideoWidget::makeVisible() { | |||
400 | 399 | ||
401 | 400 | ||
402 | 401 | ||
403 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 402 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
404 | QPainter p( this ); | 403 | QPainter p( this ); |
405 | 404 | ||
406 | if ( mediaPlayerState.isFullscreen() ) { | 405 | if ( mediaPlayerState.isFullscreen() ) { |
407 | // Clear the background | 406 | // Clear the background |
408 | p.setBrush( QBrush( Qt::black ) ); | 407 | p.setBrush( QBrush( Qt::black ) ); |
409 | } else { | 408 | } else { |
410 | if ( !pe->erased() ) { | 409 | if ( !pe->erased() ) { |
411 | // Combine with background and double buffer | 410 | // Combine with background and double buffer |
412 | QPixmap pix( pe->rect().size() ); | 411 | QPixmap pix( pe->rect().size() ); |
413 | QPainter p( &pix ); | 412 | QPainter p( &pix ); |
414 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 413 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
415 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 414 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); |
416 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { | 415 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { |
417 | paintButton( p, i ); | 416 | paintButton( p, i ); |
418 | } | 417 | } |
419 | QPainter p2( this ); | 418 | QPainter p2( this ); |
420 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 419 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
421 | } else { | 420 | } else { |
422 | QPainter p( this ); | 421 | QPainter p( this ); |
423 | for ( unsigned int i = 0; i < buttons.size(); i++ ) | 422 | for ( unsigned int i = 0; i < buttons.count(); i++ ) |
424 | paintButton( p, i ); | 423 | paintButton( p, i ); |
425 | } | 424 | } |
426 | //slider->repaint( TRUE ); | 425 | //slider->repaint( TRUE ); |
427 | } | 426 | } |
428 | } | 427 | } |
429 | 428 | ||
430 | 429 | ||
431 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 430 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
432 | switch ( e->key() ) { | 431 | switch ( e->key() ) { |
433 | ////////////////////////////// Zaurus keys | 432 | ////////////////////////////// Zaurus keys |
434 | case Key_Home: | 433 | case Key_Home: |
435 | break; | 434 | break; |
436 | case Key_F9: //activity | 435 | case Key_F9: //activity |
437 | break; | 436 | break; |
438 | case Key_F10: //contacts | 437 | case Key_F10: //contacts |
439 | // hide(); | 438 | // hide(); |