Diffstat (limited to 'core/multimedia/opieplayer/audiowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index 7da2d54..376f8d3 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp | |||
@@ -1,148 +1,153 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "audiowidget.h" | ||
21 | #include "mediaplayerstate.h" | ||
22 | |||
23 | /* OPIE */ | ||
20 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
22 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
27 | #include <opie2/odebug.h> | ||
23 | 28 | ||
29 | /* QT */ | ||
24 | #include <qdir.h> | 30 | #include <qdir.h> |
25 | #include "audiowidget.h" | ||
26 | #include "mediaplayerstate.h" | ||
27 | 31 | ||
32 | /* STD */ | ||
28 | #include <stdlib.h> | 33 | #include <stdlib.h> |
29 | #include <stdio.h> | 34 | #include <stdio.h> |
30 | 35 | ||
31 | extern MediaPlayerState *mediaPlayerState; | 36 | extern MediaPlayerState *mediaPlayerState; |
32 | 37 | ||
33 | 38 | ||
34 | static const int xo = -2; // movable x offset | 39 | static const int xo = -2; // movable x offset |
35 | static const int yo = 22; // movable y offset | 40 | static const int yo = 22; // movable y offset |
36 | 41 | ||
37 | using namespace Opie::Ui; | 42 | using namespace Opie::Ui; |
38 | struct MediaButton { | 43 | struct MediaButton { |
39 | bool isToggle, isHeld, isDown; | 44 | bool isToggle, isHeld, isDown; |
40 | }; | 45 | }; |
41 | 46 | ||
42 | //Layout information for the audioButtons (and if it is a toggle button or not) | 47 | //Layout information for the audioButtons (and if it is a toggle button or not) |
43 | MediaButton audioButtons[] = { | 48 | MediaButton audioButtons[] = { |
44 | { TRUE, FALSE, FALSE }, // play | 49 | { TRUE, FALSE, FALSE }, // play |
45 | { FALSE, FALSE, FALSE }, // stop | 50 | { FALSE, FALSE, FALSE }, // stop |
46 | { FALSE, FALSE, FALSE }, // next | 51 | { FALSE, FALSE, FALSE }, // next |
47 | { FALSE, FALSE, FALSE }, // previous | 52 | { FALSE, FALSE, FALSE }, // previous |
48 | { FALSE, FALSE, FALSE }, // volume up | 53 | { FALSE, FALSE, FALSE }, // volume up |
49 | { FALSE, FALSE, FALSE }, // volume down | 54 | { FALSE, FALSE, FALSE }, // volume down |
50 | { TRUE, FALSE, FALSE }, // repeat/loop | 55 | { TRUE, FALSE, FALSE }, // repeat/loop |
51 | { FALSE, FALSE, FALSE }, // playlist | 56 | { FALSE, FALSE, FALSE }, // playlist |
52 | { FALSE, FALSE, FALSE }, // forward | 57 | { FALSE, FALSE, FALSE }, // forward |
53 | { FALSE, FALSE, FALSE } // back | 58 | { FALSE, FALSE, FALSE } // back |
54 | }; | 59 | }; |
55 | 60 | ||
56 | const char *skin_mask_file_names[10] = { | 61 | const char *skin_mask_file_names[10] = { |
57 | "play", "stop", "next", "prev", "up", | 62 | "play", "stop", "next", "prev", "up", |
58 | "down", "loop", "playlist", "forward", "back" | 63 | "down", "loop", "playlist", "forward", "back" |
59 | }; | 64 | }; |
60 | 65 | ||
61 | static void changeTextColor( QWidget *w ) { | 66 | static void changeTextColor( QWidget *w ) { |
62 | QPalette p = w->palette(); | 67 | QPalette p = w->palette(); |
63 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); | 68 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); |
64 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | 69 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); |
65 | w->setPalette( p ); | 70 | w->setPalette( p ); |
66 | } | 71 | } |
67 | 72 | ||
68 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | 73 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); |
69 | 74 | ||
70 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 75 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
71 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) | 76 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) |
72 | { | 77 | { |
73 | setCaption( tr("OpiePlayer") ); | 78 | setCaption( tr("OpiePlayer") ); |
74 | // qDebug("<<<<<audioWidget"); | 79 | // odebug << "<<<<<audioWidget" << oendl; |
75 | 80 | ||
76 | Config cfg("OpiePlayer"); | 81 | Config cfg("OpiePlayer"); |
77 | cfg.setGroup("Options"); | 82 | cfg.setGroup("Options"); |
78 | skin = cfg.readEntry("Skin","default"); | 83 | skin = cfg.readEntry("Skin","default"); |
79 | //skin = "scaleTest"; | 84 | //skin = "scaleTest"; |
80 | // color of background, frame, degree of transparency | 85 | // color of background, frame, degree of transparency |
81 | 86 | ||
82 | // QString skinPath = "opieplayer/skins/" + skin; | 87 | // QString skinPath = "opieplayer/skins/" + skin; |
83 | QString skinPath; | 88 | QString skinPath; |
84 | skinPath = "opieplayer2/skins/" + skin; | 89 | skinPath = "opieplayer2/skins/" + skin; |
85 | if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) | 90 | if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) |
86 | skinPath = "opieplayer2/skins/default"; | 91 | skinPath = "opieplayer2/skins/default"; |
87 | 92 | ||
88 | // qDebug("skin path " + skinPath); | 93 | // odebug << "skin path " + skinPath << oendl; |
89 | 94 | ||
90 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 95 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
91 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | 96 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); |
92 | imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); | 97 | imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); |
93 | 98 | ||
94 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | 99 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); |
95 | imgButtonMask->fill( 0 ); | 100 | imgButtonMask->fill( 0 ); |
96 | 101 | ||
97 | for ( int i = 0; i < 10; i++ ) { | 102 | for ( int i = 0; i < 10; i++ ) { |
98 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; | 103 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; |
99 | masks[i] = new QBitmap( filename ); | 104 | masks[i] = new QBitmap( filename ); |
100 | 105 | ||
101 | if ( !masks[i]->isNull() ) { | 106 | if ( !masks[i]->isNull() ) { |
102 | QImage imgMask = masks[i]->convertToImage(); | 107 | QImage imgMask = masks[i]->convertToImage(); |
103 | uchar **dest = imgButtonMask->jumpTable(); | 108 | uchar **dest = imgButtonMask->jumpTable(); |
104 | for ( int y = 0; y < imgUp->height(); y++ ) { | 109 | for ( int y = 0; y < imgUp->height(); y++ ) { |
105 | uchar *line = dest[y]; | 110 | uchar *line = dest[y]; |
106 | for ( int x = 0; x < imgUp->width(); x++ ) | 111 | for ( int x = 0; x < imgUp->width(); x++ ) |
107 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 112 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
108 | line[x] = i + 1; | 113 | line[x] = i + 1; |
109 | } | 114 | } |
110 | } | 115 | } |
111 | 116 | ||
112 | } | 117 | } |
113 | 118 | ||
114 | for ( int i = 0; i < 11; i++ ) { | 119 | for ( int i = 0; i < 11; i++ ) { |
115 | buttonPixUp[i] = NULL; | 120 | buttonPixUp[i] = NULL; |
116 | buttonPixDown[i] = NULL; | 121 | buttonPixDown[i] = NULL; |
117 | } | 122 | } |
118 | 123 | ||
119 | QWidget *d = QApplication::desktop(); | 124 | QWidget *d = QApplication::desktop(); |
120 | int width = d->width(); | 125 | int width = d->width(); |
121 | int height = d->height(); | 126 | int height = d->height(); |
122 | 127 | ||
123 | if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { | 128 | if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { |
124 | // qDebug("<<<<<<<< scale image >>>>>>>>>>>>"); | 129 | // odebug << "<<<<<<<< scale image >>>>>>>>>>>>" << oendl; |
125 | QImage img; | 130 | QImage img; |
126 | img = pixBg->convertToImage(); | 131 | img = pixBg->convertToImage(); |
127 | pixBg->convertFromImage( img.smoothScale( width, height)); | 132 | pixBg->convertFromImage( img.smoothScale( width, height)); |
128 | } | 133 | } |
129 | setBackgroundPixmap( *pixBg); | 134 | setBackgroundPixmap( *pixBg); |
130 | 135 | ||
131 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 136 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
132 | 137 | ||
133 | // changeTextColor( &songInfo ); | 138 | // changeTextColor( &songInfo ); |
134 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | 139 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); |
135 | // songInfo.setFrameStyle( QFrame::NoFrame); | 140 | // songInfo.setFrameStyle( QFrame::NoFrame); |
136 | // songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | 141 | // songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); |
137 | //NoFrame | 142 | //NoFrame |
138 | // songInfo.setForegroundColor(Qt::white); | 143 | // songInfo.setForegroundColor(Qt::white); |
139 | 144 | ||
140 | slider.setFixedHeight( 20 ); | 145 | slider.setFixedHeight( 20 ); |
141 | slider.setMinValue( 0 ); | 146 | slider.setMinValue( 0 ); |
142 | slider.setMaxValue( 1 ); | 147 | slider.setMaxValue( 1 ); |
143 | slider.setFocusPolicy( QWidget::NoFocus ); | 148 | slider.setFocusPolicy( QWidget::NoFocus ); |
144 | 149 | ||
145 | slider.setBackgroundPixmap( *pixBg ); | 150 | slider.setBackgroundPixmap( *pixBg ); |
146 | 151 | ||
147 | time.setFocusPolicy( QWidget::NoFocus ); | 152 | time.setFocusPolicy( QWidget::NoFocus ); |
148 | time.setAlignment( Qt::AlignCenter ); | 153 | time.setAlignment( Qt::AlignCenter ); |
@@ -232,49 +237,49 @@ void AudioWidget::resizeEvent( QResizeEvent * ) { | |||
232 | } | 237 | } |
233 | 238 | ||
234 | delete pixUp; | 239 | delete pixUp; |
235 | delete pixDn; | 240 | delete pixDn; |
236 | } | 241 | } |
237 | 242 | ||
238 | 243 | ||
239 | static bool audioSliderBeingMoved = FALSE; | 244 | static bool audioSliderBeingMoved = FALSE; |
240 | 245 | ||
241 | void AudioWidget::sliderPressed() { | 246 | void AudioWidget::sliderPressed() { |
242 | audioSliderBeingMoved = TRUE; | 247 | audioSliderBeingMoved = TRUE; |
243 | } | 248 | } |
244 | 249 | ||
245 | 250 | ||
246 | void AudioWidget::sliderReleased() { | 251 | void AudioWidget::sliderReleased() { |
247 | audioSliderBeingMoved = FALSE; | 252 | audioSliderBeingMoved = FALSE; |
248 | if ( slider.width() == 0 ) | 253 | if ( slider.width() == 0 ) |
249 | return; | 254 | return; |
250 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); | 255 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); |
251 | mediaPlayerState->setPosition( val ); | 256 | mediaPlayerState->setPosition( val ); |
252 | } | 257 | } |
253 | 258 | ||
254 | 259 | ||
255 | void AudioWidget::setPosition( long i ) { | 260 | void AudioWidget::setPosition( long i ) { |
256 | // qDebug("set position %d",i); | 261 | // odebug << "set position " << i << "" << oendl; |
257 | long length = mediaPlayerState->length(); | 262 | long length = mediaPlayerState->length(); |
258 | updateSlider( i, length ); | 263 | updateSlider( i, length ); |
259 | } | 264 | } |
260 | 265 | ||
261 | 266 | ||
262 | void AudioWidget::setLength( long max ) { | 267 | void AudioWidget::setLength( long max ) { |
263 | updateSlider( mediaPlayerState->position(), max ); | 268 | updateSlider( mediaPlayerState->position(), max ); |
264 | } | 269 | } |
265 | 270 | ||
266 | 271 | ||
267 | void AudioWidget::setView( char view ) { | 272 | void AudioWidget::setView( char view ) { |
268 | 273 | ||
269 | if (mediaPlayerState->isStreaming) { | 274 | if (mediaPlayerState->isStreaming) { |
270 | if( !slider.isHidden()) slider.hide(); | 275 | if( !slider.isHidden()) slider.hide(); |
271 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 276 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
272 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 277 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
273 | } else { | 278 | } else { |
274 | // this stops the slider from being moved, thus | 279 | // this stops the slider from being moved, thus |
275 | // does not stop stream when it reaches the end | 280 | // does not stop stream when it reaches the end |
276 | slider.show(); | 281 | slider.show(); |
277 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 282 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
278 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 283 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
279 | } | 284 | } |
280 | 285 | ||
@@ -346,60 +351,60 @@ void AudioWidget::timerEvent( QTimerEvent * ) { | |||
346 | p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 ); | 351 | p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 ); |
347 | p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 ); | 352 | p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 ); |
348 | */ | 353 | */ |
349 | /* | 354 | /* |
350 | static int frame = 0; | 355 | static int frame = 0; |
351 | if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) { | 356 | if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) { |
352 | frame = frame >= 7 ? 0 : frame + 1; | 357 | frame = frame >= 7 ? 0 : frame + 1; |
353 | } | 358 | } |
354 | */ | 359 | */ |
355 | } | 360 | } |
356 | 361 | ||
357 | 362 | ||
358 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 363 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
359 | for ( int i = 0; i < numButtons; i++ ) { | 364 | for ( int i = 0; i < numButtons; i++ ) { |
360 | if ( event->state() == QMouseEvent::LeftButton ) { | 365 | if ( event->state() == QMouseEvent::LeftButton ) { |
361 | 366 | ||
362 | // The test to see if the mouse click is inside the button or not | 367 | // The test to see if the mouse click is inside the button or not |
363 | int x = event->pos().x() - xoff; | 368 | int x = event->pos().x() - xoff; |
364 | int y = event->pos().y() - yoff; | 369 | int y = event->pos().y() - yoff; |
365 | 370 | ||
366 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 371 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
367 | && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 372 | && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
368 | 373 | ||
369 | // if ( isOnButton && i == AudioVolumeUp ) | 374 | // if ( isOnButton && i == AudioVolumeUp ) |
370 | // qDebug("on up"); | 375 | // odebug << "on up" << oendl; |
371 | 376 | ||
372 | if ( isOnButton && !audioButtons[i].isHeld ) { | 377 | if ( isOnButton && !audioButtons[i].isHeld ) { |
373 | audioButtons[i].isHeld = TRUE; | 378 | audioButtons[i].isHeld = TRUE; |
374 | toggleButton(i); | 379 | toggleButton(i); |
375 | switch (i) { | 380 | switch (i) { |
376 | case AudioVolumeUp: | 381 | case AudioVolumeUp: |
377 | // qDebug("more clicked"); | 382 | // odebug << "more clicked" << oendl; |
378 | emit moreClicked(); | 383 | emit moreClicked(); |
379 | return; | 384 | return; |
380 | case AudioVolumeDown: | 385 | case AudioVolumeDown: |
381 | // qDebug("less clicked"); | 386 | // odebug << "less clicked" << oendl; |
382 | emit lessClicked(); | 387 | emit lessClicked(); |
383 | return; | 388 | return; |
384 | case AudioForward: | 389 | case AudioForward: |
385 | emit forwardClicked(); | 390 | emit forwardClicked(); |
386 | return; | 391 | return; |
387 | case AudioBack: | 392 | case AudioBack: |
388 | emit backClicked(); | 393 | emit backClicked(); |
389 | return; | 394 | return; |
390 | } | 395 | } |
391 | } else if ( !isOnButton && audioButtons[i].isHeld ) { | 396 | } else if ( !isOnButton && audioButtons[i].isHeld ) { |
392 | audioButtons[i].isHeld = FALSE; | 397 | audioButtons[i].isHeld = FALSE; |
393 | toggleButton(i); | 398 | toggleButton(i); |
394 | } | 399 | } |
395 | } else { | 400 | } else { |
396 | if ( audioButtons[i].isHeld ) { | 401 | if ( audioButtons[i].isHeld ) { |
397 | audioButtons[i].isHeld = FALSE; | 402 | audioButtons[i].isHeld = FALSE; |
398 | if ( !audioButtons[i].isToggle ) | 403 | if ( !audioButtons[i].isToggle ) |
399 | setToggleButton( i, FALSE ); | 404 | setToggleButton( i, FALSE ); |
400 | switch (i) { | 405 | switch (i) { |
401 | case AudioPlay: | 406 | case AudioPlay: |
402 | if( mediaPlayerState->isPaused ) { | 407 | if( mediaPlayerState->isPaused ) { |
403 | mediaPlayerState->setPaused( FALSE ); | 408 | mediaPlayerState->setPaused( FALSE ); |
404 | return; | 409 | return; |
405 | } else if( !mediaPlayerState->isPaused ) { | 410 | } else if( !mediaPlayerState->isPaused ) { |
@@ -449,49 +454,49 @@ void AudioWidget::paintEvent( QPaintEvent * pe) { | |||
449 | // Combine with background and double buffer | 454 | // Combine with background and double buffer |
450 | QPixmap pix( pe->rect().size() ); | 455 | QPixmap pix( pe->rect().size() ); |
451 | QPainter p( &pix ); | 456 | QPainter p( &pix ); |
452 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 457 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
453 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 458 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |
454 | for ( int i = 0; i < numButtons; i++ ) | 459 | for ( int i = 0; i < numButtons; i++ ) |
455 | paintButton( &p, i ); | 460 | paintButton( &p, i ); |
456 | QPainter p2( this ); | 461 | QPainter p2( this ); |
457 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 462 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
458 | } else { | 463 | } else { |
459 | QPainter p( this ); | 464 | QPainter p( this ); |
460 | for ( int i = 0; i < numButtons; i++ ) | 465 | for ( int i = 0; i < numButtons; i++ ) |
461 | paintButton( &p, i ); | 466 | paintButton( &p, i ); |
462 | } | 467 | } |
463 | } | 468 | } |
464 | 469 | ||
465 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) | 470 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) |
466 | { | 471 | { |
467 | switch ( e->key() ) { | 472 | switch ( e->key() ) { |
468 | ////////////////////////////// Zaurus keys | 473 | ////////////////////////////// Zaurus keys |
469 | case Key_Home: | 474 | case Key_Home: |
470 | break; | 475 | break; |
471 | case Key_F9: //activity | 476 | case Key_F9: //activity |
472 | hide(); | 477 | hide(); |
473 | // qDebug("Audio F9"); | 478 | // odebug << "Audio F9" << oendl; |
474 | break; | 479 | break; |
475 | case Key_F10: //contacts | 480 | case Key_F10: //contacts |
476 | break; | 481 | break; |
477 | case Key_F11: //menu | 482 | case Key_F11: //menu |
478 | break; | 483 | break; |
479 | case Key_F12: //home | 484 | case Key_F12: //home |
480 | break; | 485 | break; |
481 | case Key_F13: //mail | 486 | case Key_F13: //mail |
482 | break; | 487 | break; |
483 | case Key_Space: { | 488 | case Key_Space: { |
484 | 489 | ||
485 | if(mediaPlayerState->playing()) { | 490 | if(mediaPlayerState->playing()) { |
486 | // toggleButton(1); | 491 | // toggleButton(1); |
487 | mediaPlayerState->setPlaying(FALSE); | 492 | mediaPlayerState->setPlaying(FALSE); |
488 | // toggleButton(1); | 493 | // toggleButton(1); |
489 | } else { | 494 | } else { |
490 | // toggleButton(0); | 495 | // toggleButton(0); |
491 | mediaPlayerState->setPlaying(TRUE); | 496 | mediaPlayerState->setPlaying(TRUE); |
492 | // toggleButton(0); | 497 | // toggleButton(0); |
493 | } | 498 | } |
494 | } | 499 | } |
495 | break; | 500 | break; |
496 | case Key_Down: //volume | 501 | case Key_Down: //volume |
497 | // toggleButton(6); | 502 | // toggleButton(6); |