-rw-r--r-- | core/multimedia/opieplayer/audiodevice.cpp | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.cpp | 142 | ||||
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.h | 45 | ||||
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol.cpp | 29 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistselection.cpp | 9 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 212 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.h | 17 | ||||
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 110 | ||||
-rw-r--r-- | core/multimedia/opieplayer/videowidget.h | 3 |
9 files changed, 356 insertions, 213 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp index 5fef792..2087c7f 100644 --- a/core/multimedia/opieplayer/audiodevice.cpp +++ b/core/multimedia/opieplayer/audiodevice.cpp | |||
@@ -197,11 +197,9 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { | |||
197 | if( bps == 8) format = AFMT_U8; | 197 | if( bps == 8) format = AFMT_U8; |
198 | else if( bps <= 0) format = AFMT_S16_LE; | 198 | else if( bps <= 0) format = AFMT_S16_LE; |
199 | else format = AFMT_S16_LE; | 199 | else format = AFMT_S16_LE; |
200 | |||
201 | qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format); | 200 | qDebug("AD- freq %d, channels %d, b/sample %d, bitrate %d",f,chs,bps,format); |
202 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); | 201 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); |
203 | 202 | ||
204 | |||
205 | int fragments = 0x10000 * 8 + sound_fragment_shift; | 203 | int fragments = 0x10000 * 8 + sound_fragment_shift; |
206 | int capabilities = 0; | 204 | int capabilities = 0; |
207 | 205 | ||
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index 582660c..3901446 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp | |||
@@ -17,12 +17,15 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qpe/qpeapplication.h> | ||
21 | #include <qpe/resource.h> | ||
22 | |||
20 | #include <qwidget.h> | 23 | #include <qwidget.h> |
21 | #include <qpixmap.h> | 24 | #include <qpixmap.h> |
22 | #include <qbutton.h> | 25 | #include <qbutton.h> |
23 | #include <qpainter.h> | 26 | #include <qpainter.h> |
24 | #include <qframe.h> | 27 | #include <qframe.h> |
25 | #include <qpe/resource.h> | 28 | |
26 | #include "audiowidget.h" | 29 | #include "audiowidget.h" |
27 | #include "mediaplayerstate.h" | 30 | #include "mediaplayerstate.h" |
28 | 31 | ||
@@ -60,6 +63,7 @@ static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | |||
60 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 63 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
61 | QWidget( parent, name, f ) | 64 | QWidget( parent, name, f ) |
62 | { | 65 | { |
66 | // QPEApplication::grabKeyboard(); | ||
63 | setCaption( tr("OpiePlayer") ); | 67 | setCaption( tr("OpiePlayer") ); |
64 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); | 68 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); |
65 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsAll" ) ); | 69 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsAll" ) ); |
@@ -200,48 +204,49 @@ void AudioWidget::timerEvent( QTimerEvent * ) { | |||
200 | 204 | ||
201 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 205 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
202 | for ( int i = 0; i < numButtons; i++ ) { | 206 | for ( int i = 0; i < numButtons; i++ ) { |
203 | int size = audioButtons[i].isBig; | 207 | int size = audioButtons[i].isBig; |
204 | int x = audioButtons[i].xPos; | 208 | int x = audioButtons[i].xPos; |
205 | int y = audioButtons[i].yPos; | 209 | int y = audioButtons[i].yPos; |
206 | if ( event->state() == QMouseEvent::LeftButton ) { | 210 | if ( event->state() == QMouseEvent::LeftButton ) { |
207 | // The test to see if the mouse click is inside the circular button or not | 211 | // The test to see if the mouse click is inside the circular button or not |
208 | // (compared with the radius squared to avoid a square-root of our distance) | 212 | // (compared with the radius squared to avoid a square-root of our distance) |
209 | int radius = 32 + 13 * size; | 213 | int radius = 32 + 13 * size; |
210 | QPoint center = QPoint( x + radius, y + radius ); | 214 | QPoint center = QPoint( x + radius, y + radius ); |
211 | QPoint dXY = center - event->pos(); | 215 | QPoint dXY = center - event->pos(); |
212 | int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); | 216 | int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); |
213 | bool isOnButton = dist <= (radius * radius); | 217 | bool isOnButton = dist <= (radius * radius); |
214 | // QRect r( x, y, 64 + 22*size, 64 + 22*size ); | 218 | // QRect r( x, y, 64 + 22*size, 64 + 22*size ); |
215 | // bool isOnButton = r.contains( event->pos() ); // Rectangular Button code | 219 | // bool isOnButton = r.contains( event->pos() ); // Rectangular Button code |
216 | if ( isOnButton && !audioButtons[i].isHeld ) { | 220 | if ( isOnButton && !audioButtons[i].isHeld ) { |
217 | audioButtons[i].isHeld = TRUE; | 221 | audioButtons[i].isHeld = TRUE; |
218 | toggleButton(i); | 222 | toggleButton(i); |
219 | switch (i) { | 223 | qDebug("button toggled %d",i); |
220 | case AudioVolumeUp: emit moreClicked(); return; | 224 | switch (i) { |
221 | case AudioVolumeDown: emit lessClicked(); return; | 225 | case AudioVolumeUp: emit moreClicked(); return; |
222 | } | 226 | case AudioVolumeDown: emit lessClicked(); return; |
223 | } else if ( !isOnButton && audioButtons[i].isHeld ) { | 227 | } |
224 | audioButtons[i].isHeld = FALSE; | 228 | } else if ( !isOnButton && audioButtons[i].isHeld ) { |
225 | toggleButton(i); | 229 | audioButtons[i].isHeld = FALSE; |
226 | } | 230 | toggleButton(i); |
227 | } else { | 231 | } |
228 | if ( audioButtons[i].isHeld ) { | 232 | } else { |
229 | audioButtons[i].isHeld = FALSE; | 233 | if ( audioButtons[i].isHeld ) { |
230 | if ( !audioButtons[i].isToggle ) | 234 | audioButtons[i].isHeld = FALSE; |
231 | setToggleButton( i, FALSE ); | 235 | if ( !audioButtons[i].isToggle ) |
232 | switch (i) { | 236 | setToggleButton( i, FALSE ); |
233 | case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; | 237 | switch (i) { |
234 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; | 238 | case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; |
235 | case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return; | 239 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; |
236 | case AudioNext: mediaPlayerState->setNext(); return; | 240 | case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return; |
237 | case AudioPrevious: mediaPlayerState->setPrev(); return; | 241 | case AudioNext: mediaPlayerState->setNext(); return; |
238 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; | 242 | case AudioPrevious: mediaPlayerState->setPrev(); return; |
239 | case AudioVolumeUp: emit moreReleased(); return; | 243 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; |
240 | case AudioVolumeDown: emit lessReleased(); return; | 244 | case AudioVolumeUp: emit moreReleased(); return; |
241 | case AudioPlayList: mediaPlayerState->setList(); return; | 245 | case AudioVolumeDown: emit lessReleased(); return; |
242 | } | 246 | case AudioPlayList: mediaPlayerState->setList(); return; |
243 | } | 247 | } |
244 | } | 248 | } |
249 | } | ||
245 | } | 250 | } |
246 | } | 251 | } |
247 | 252 | ||
@@ -274,3 +279,58 @@ void AudioWidget::paintEvent( QPaintEvent * ) { | |||
274 | } | 279 | } |
275 | 280 | ||
276 | 281 | ||
282 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) | ||
283 | { | ||
284 | switch ( e->key() ) { | ||
285 | ////////////////////////////// Zaurus keys | ||
286 | case Key_Home: | ||
287 | break; | ||
288 | case Key_F9: //activity | ||
289 | break; | ||
290 | case Key_F10: //contacts | ||
291 | break; | ||
292 | case Key_F11: //menu | ||
293 | break; | ||
294 | case Key_F12: //home | ||
295 | break; | ||
296 | case Key_F13: //mail | ||
297 | break; | ||
298 | case Key_Space: { | ||
299 | if(mediaPlayerState->playing()) { | ||
300 | // toggleButton(1); | ||
301 | mediaPlayerState->setPlaying(FALSE); | ||
302 | // toggleButton(1); | ||
303 | } else { | ||
304 | // toggleButton(0); | ||
305 | mediaPlayerState->setPlaying(TRUE); | ||
306 | // toggleButton(0); | ||
307 | } | ||
308 | } | ||
309 | break; | ||
310 | case Key_Down: | ||
311 | toggleButton(6); | ||
312 | emit lessClicked(); | ||
313 | emit lessReleased(); | ||
314 | toggleButton(6); | ||
315 | break; | ||
316 | case Key_Up: | ||
317 | toggleButton(5); | ||
318 | emit moreClicked(); | ||
319 | emit moreReleased(); | ||
320 | toggleButton(5); | ||
321 | break; | ||
322 | case Key_Right: | ||
323 | // toggleButton(3); | ||
324 | mediaPlayerState->setNext(); | ||
325 | // toggleButton(3); | ||
326 | break; | ||
327 | case Key_Left: | ||
328 | // toggleButton(4); | ||
329 | mediaPlayerState->setPrev(); | ||
330 | // toggleButton(4); | ||
331 | break; | ||
332 | case Key_Escape: | ||
333 | break; | ||
334 | |||
335 | }; | ||
336 | } | ||
diff --git a/core/multimedia/opieplayer/audiowidget.h b/core/multimedia/opieplayer/audiowidget.h index 53e84b3..a2850aa 100644 --- a/core/multimedia/opieplayer/audiowidget.h +++ b/core/multimedia/opieplayer/audiowidget.h | |||
@@ -52,41 +52,41 @@ class Ticker : public QFrame { | |||
52 | Q_OBJECT | 52 | Q_OBJECT |
53 | public: | 53 | public: |
54 | Ticker( QWidget* parent=0 ) : QFrame( parent ) { | 54 | Ticker( QWidget* parent=0 ) : QFrame( parent ) { |
55 | setFrameStyle( WinPanel | Sunken ); | 55 | setFrameStyle( WinPanel | Sunken ); |
56 | setText( "No Song" ); | 56 | setText( "No Song" ); |
57 | } | 57 | } |
58 | ~Ticker() { } | 58 | ~Ticker() { } |
59 | void setText( const QString& text ) { | 59 | void setText( const QString& text ) { |
60 | pos = 0; // reset it everytime the text is changed | 60 | pos = 0; // reset it everytime the text is changed |
61 | scrollText = text; | 61 | scrollText = text; |
62 | pixelLen = fontMetrics().width( scrollText ); | 62 | pixelLen = fontMetrics().width( scrollText ); |
63 | killTimers(); | 63 | killTimers(); |
64 | if ( pixelLen > width() ) | 64 | if ( pixelLen > width() ) |
65 | startTimer( 50 ); | 65 | startTimer( 50 ); |
66 | update(); | 66 | update(); |
67 | } | 67 | } |
68 | protected: | 68 | protected: |
69 | void timerEvent( QTimerEvent * ) { | 69 | void timerEvent( QTimerEvent * ) { |
70 | pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; | 70 | pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; |
71 | #ifndef USE_DBLBUF | 71 | #ifndef USE_DBLBUF |
72 | scroll( -1, 0, contentsRect() ); | 72 | scroll( -1, 0, contentsRect() ); |
73 | #else | 73 | #else |
74 | repaint( FALSE ); | 74 | repaint( FALSE ); |
75 | #endif | 75 | #endif |
76 | } | 76 | } |
77 | void drawContents( QPainter *p ) { | 77 | void drawContents( QPainter *p ) { |
78 | #ifndef USE_DBLBUF | 78 | #ifndef USE_DBLBUF |
79 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) | 79 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) |
80 | p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | 80 | p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); |
81 | #else | 81 | #else |
82 | // Double buffering code. | 82 | // Double buffering code. |
83 | // Looks like qvfb makes it look like it flickers but I don't think it really is | 83 | // Looks like qvfb makes it look like it flickers but I don't think it really is |
84 | QPixmap pm( width(), height() ); | 84 | QPixmap pm( width(), height() ); |
85 | pm.fill( colorGroup().base() ); | 85 | pm.fill( colorGroup().base() ); |
86 | QPainter pmp( &pm ); | 86 | QPainter pmp( &pm ); |
87 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) | 87 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) |
88 | pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | 88 | pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); |
89 | p->drawPixmap( 0, 0, pm ); | 89 | p->drawPixmap( 0, 0, pm ); |
90 | #endif | 90 | #endif |
91 | } | 91 | } |
92 | private: | 92 | private: |
@@ -128,6 +128,7 @@ protected: | |||
128 | void mouseReleaseEvent( QMouseEvent *event ); | 128 | void mouseReleaseEvent( QMouseEvent *event ); |
129 | void timerEvent( QTimerEvent *event ); | 129 | void timerEvent( QTimerEvent *event ); |
130 | void closeEvent( QCloseEvent *event ); | 130 | void closeEvent( QCloseEvent *event ); |
131 | void keyReleaseEvent( QKeyEvent *e); | ||
131 | 132 | ||
132 | private: | 133 | private: |
133 | void toggleButton( int ); | 134 | void toggleButton( int ); |
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp index cb8de8a..4b2827e 100644 --- a/core/multimedia/opieplayer/loopcontrol.cpp +++ b/core/multimedia/opieplayer/loopcontrol.cpp | |||
@@ -221,7 +221,6 @@ void LoopControl::startVideo() { | |||
221 | 221 | ||
222 | void LoopControl::startAudio() { | 222 | void LoopControl::startAudio() { |
223 | 223 | ||
224 | //qDebug("start audio"); | ||
225 | audioMutex->lock(); | 224 | audioMutex->lock(); |
226 | if ( moreAudio ) { | 225 | if ( moreAudio ) { |
227 | 226 | ||
@@ -237,14 +236,14 @@ void LoopControl::startAudio() { | |||
237 | long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; | 236 | long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; |
238 | long sampleWaitTime = currentSample - sampleWeShouldBeAt; | 237 | long sampleWaitTime = currentSample - sampleWeShouldBeAt; |
239 | 238 | ||
240 | // if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { | 239 | // if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { |
241 | // usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); | 240 | // usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); |
242 | // } | 241 | // } |
243 | // else if ( sampleWaitTime <= -5000 ) { | 242 | // else if ( sampleWaitTime <= -5000 ) { |
244 | // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); | 243 | // // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); |
245 | // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); | 244 | // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); |
246 | // currentSample = sampleWeShouldBeAt; | 245 | // currentSample = sampleWeShouldBeAt; |
247 | // } | 246 | // } |
248 | 247 | ||
249 | audioDevice->write( audioBuffer, samplesRead * 2 * channels ); | 248 | audioDevice->write( audioBuffer, samplesRead * 2 * channels ); |
250 | audioSampleCounter = currentSample + samplesRead - 1; | 249 | audioSampleCounter = currentSample + samplesRead - 1; |
@@ -379,7 +378,7 @@ bool LoopControl::init( const QString& filename ) { | |||
379 | int astream = 0; | 378 | int astream = 0; |
380 | 379 | ||
381 | channels = mediaPlayerState->curDecoder()->audioChannels( astream ); | 380 | channels = mediaPlayerState->curDecoder()->audioChannels( astream ); |
382 | qDebug( "LC- channels = %d", channels ); | 381 | // qDebug( "LC- channels = %d", channels ); |
383 | 382 | ||
384 | if ( !total_audio_samples ) | 383 | if ( !total_audio_samples ) |
385 | total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); | 384 | total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); |
@@ -389,15 +388,17 @@ bool LoopControl::init( const QString& filename ) { | |||
389 | mediaPlayerState->setLength( total_audio_samples ); | 388 | mediaPlayerState->setLength( total_audio_samples ); |
390 | 389 | ||
391 | freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); | 390 | freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); |
392 | qDebug( "LC- frequency = %d", freq ); | 391 | // qDebug( "LC- frequency = %d", freq ); |
393 | 392 | ||
394 | audioSampleCounter = 0; | 393 | audioSampleCounter = 0; |
395 | int bits_per_sample; | 394 | int bits_per_sample; |
396 | if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibWavPlugin") ) { | 395 | if ( mediaPlayerState->curDecoder()->pluginName() == QString("WavPlugin") ) { |
397 | bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime(); | 396 | bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime(); |
398 | qDebug("using stupid hack"); | 397 | // qDebug("using stupid hack"); |
399 | } else { | 398 | } else { |
400 | bits_per_sample=0; | 399 | bits_per_sample=0; |
400 | // freq=44100; | ||
401 | channels=2; | ||
401 | } | 402 | } |
402 | 403 | ||
403 | audioDevice = new AudioDevice( freq, channels, bits_per_sample); | 404 | audioDevice = new AudioDevice( freq, channels, bits_per_sample); |
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp index 4019d12..47fc731 100644 --- a/core/multimedia/opieplayer/playlistselection.cpp +++ b/core/multimedia/opieplayer/playlistselection.cpp | |||
@@ -55,7 +55,7 @@ PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) | |||
55 | // setStaticBackground( TRUE ); | 55 | // setStaticBackground( TRUE ); |
56 | // setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) ); | 56 | // setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) ); |
57 | 57 | ||
58 | // setBackgroundPixmap( Resource::loadPixmap( "opielogo" ) ); | 58 | setBackgroundPixmap( Resource::loadPixmap( "opielogo" ) ); |
59 | // #endif | 59 | // #endif |
60 | // addColumn("Title",236); | 60 | // addColumn("Title",236); |
61 | // setAllColumnsShowFocus( TRUE ); | 61 | // setAllColumnsShowFocus( TRUE ); |
@@ -73,10 +73,9 @@ PlayListSelection::~PlayListSelection() { | |||
73 | void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { | 73 | void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { |
74 | // qDebug("drawBackground"); | 74 | // qDebug("drawBackground"); |
75 | p->fillRect( r, QBrush( white ) ); | 75 | p->fillRect( r, QBrush( white ) ); |
76 | // QImage logo = Resource::loadImage( "mpegplayer/background" ); | 76 | QImage logo = Resource::loadImage( "opielogo" ); |
77 | // // QImage logo = Resource::loadImage( "opielogo" ); | 77 | if ( !logo.isNull() ) |
78 | // if ( !logo.isNull() ) | 78 | p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); |
79 | // p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); | ||
80 | } | 79 | } |
81 | // #endif | 80 | // #endif |
82 | 81 | ||
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 9969526..524747e 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -105,6 +105,7 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
105 | d = new PlayListWidgetPrivate; | 105 | d = new PlayListWidgetPrivate; |
106 | d->setDocumentUsed = FALSE; | 106 | d->setDocumentUsed = FALSE; |
107 | d->current = NULL; | 107 | d->current = NULL; |
108 | fromSetDocument = FALSE; | ||
108 | // menuTimer = new QTimer( this ,"menu timer"), | 109 | // menuTimer = new QTimer( this ,"menu timer"), |
109 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); | 110 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); |
110 | 111 | ||
@@ -174,10 +175,11 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
174 | 175 | ||
175 | QWidget *pTab; | 176 | QWidget *pTab; |
176 | pTab = new QWidget( tabWidget, "pTab" ); | 177 | pTab = new QWidget( tabWidget, "pTab" ); |
177 | playlistView = new QListView( pTab, "Videoview" ); | 178 | // playlistView = new QListView( pTab, "playlistview" ); |
178 | playlistView->setMinimumSize(236,260); | 179 | // playlistView->setMinimumSize(236,260); |
179 | tabWidget->insertTab( pTab,"Playlist"); | 180 | tabWidget->insertTab( pTab,"Playlist"); |
180 | 181 | ||
182 | |||
181 | // Add the playlist area | 183 | // Add the playlist area |
182 | 184 | ||
183 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 185 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
@@ -189,6 +191,11 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
189 | d->selectedFiles = new PlayListSelection( hbox2); | 191 | d->selectedFiles = new PlayListSelection( hbox2); |
190 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 192 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
191 | 193 | ||
194 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); | ||
195 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | ||
196 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); | ||
197 | |||
198 | |||
192 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 199 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
193 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 200 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
194 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 201 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
@@ -204,7 +211,14 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
204 | audioView->addColumn("Media",35); | 211 | audioView->addColumn("Media",35); |
205 | audioView->setColumnAlignment(1, Qt::AlignRight); | 212 | audioView->setColumnAlignment(1, Qt::AlignRight); |
206 | audioView->setColumnAlignment(2, Qt::AlignRight); | 213 | audioView->setColumnAlignment(2, Qt::AlignRight); |
214 | audioView->setAllColumnsShowFocus(TRUE); | ||
207 | tabWidget->insertTab(aTab,"Audio"); | 215 | tabWidget->insertTab(aTab,"Audio"); |
216 | |||
217 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); | ||
218 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | ||
219 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | ||
220 | |||
221 | |||
208 | // audioView | 222 | // audioView |
209 | Global::findDocuments(&files, "audio/*"); | 223 | Global::findDocuments(&files, "audio/*"); |
210 | QListIterator<DocLnk> dit( files.children() ); | 224 | QListIterator<DocLnk> dit( files.children() ); |
@@ -232,6 +246,10 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
232 | videoView->addColumn("Media",35); | 246 | videoView->addColumn("Media",35); |
233 | videoView->setColumnAlignment(1, Qt::AlignRight); | 247 | videoView->setColumnAlignment(1, Qt::AlignRight); |
234 | videoView->setColumnAlignment(2, Qt::AlignRight); | 248 | videoView->setColumnAlignment(2, Qt::AlignRight); |
249 | videoView->setAllColumnsShowFocus(TRUE); | ||
250 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); | ||
251 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | ||
252 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | ||
235 | 253 | ||
236 | tabWidget->insertTab( vTab,"Video"); | 254 | tabWidget->insertTab( vTab,"Video"); |
237 | 255 | ||
@@ -261,8 +279,6 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
261 | 279 | ||
262 | 280 | ||
263 | // add the library area | 281 | // add the library area |
264 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | ||
265 | |||
266 | 282 | ||
267 | // connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), | 283 | // connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), |
268 | // this, SLOT( fauxPlay( QListViewItem *) ) ); | 284 | // this, SLOT( fauxPlay( QListViewItem *) ) ); |
@@ -419,25 +435,26 @@ void PlayListWidget::addAllVideoToList() { | |||
419 | 435 | ||
420 | 436 | ||
421 | void PlayListWidget::setDocument(const QString& fileref) { | 437 | void PlayListWidget::setDocument(const QString& fileref) { |
438 | fromSetDocument = TRUE; | ||
422 | if ( fileref.isNull() ) { | 439 | if ( fileref.isNull() ) { |
423 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); | 440 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); |
424 | return; | 441 | return; |
425 | } | 442 | } |
426 | // qDebug("setDocument"); | 443 | // qDebug("setDocument "+fileref); |
427 | if(fileref.find("playlist",0,TRUE) == -1) { | 444 | if(fileref.find("playlist",0,TRUE) == -1) { |
428 | addToSelection( DocLnk( fileref ) ); | 445 | clearList(); |
429 | d->setDocumentUsed = TRUE; | 446 | addToSelection( DocLnk( fileref ) ); |
430 | qApp->processEvents(); | 447 | d->setDocumentUsed = TRUE; |
431 | mediaPlayerState->setPlaying( FALSE ); | 448 | mediaPlayerState->setPlaying( FALSE ); |
432 | qApp->processEvents(); | 449 | qApp->processEvents(); |
433 | mediaPlayerState->setPlaying( TRUE ); | 450 | mediaPlayerState->setPlaying( TRUE ); |
434 | d->selectedFiles->removeSelected( ); | 451 | qApp->processEvents(); |
435 | } else { | 452 | setCaption("OpiePlayer"); |
453 | |||
454 | } else { //is playlist | ||
455 | clearList(); | ||
436 | loadList(DocLnk(fileref)); | 456 | loadList(DocLnk(fileref)); |
437 | d->selectedFiles->first(); | 457 | d->selectedFiles->first(); |
438 | // mediaPlayerState->setPlaying( TRUE ); | ||
439 | // mediaPlayerState->setPlaying( FALSE ); | ||
440 | |||
441 | } | 458 | } |
442 | } | 459 | } |
443 | 460 | ||
@@ -455,20 +472,54 @@ void PlayListWidget::useSelectedDocument() { | |||
455 | } | 472 | } |
456 | 473 | ||
457 | 474 | ||
458 | const DocLnk *PlayListWidget::current() { | 475 | const DocLnk *PlayListWidget::current() { // this is fugly |
459 | 476 | ||
460 | // qDebug("in Playlist widget ::current"); | 477 | // if( fromSetDocument) { |
461 | if ( mediaPlayerState->playlist() ) { | 478 | // qDebug("from setDoc"); |
462 | return d->selectedFiles->current(); | 479 | // DocLnkSet files; |
463 | } | 480 | // Global::findDocuments(&files, "video/*;audio/*"); |
464 | else if ( d->setDocumentUsed && d->current ) { | 481 | // QListIterator<DocLnk> dit( files.children() ); |
465 | return d->current; | 482 | // for ( ; dit.current(); ++dit ) { |
466 | } else { | 483 | // if(dit.current()->linkFile() == setDocFileRef) { |
467 | return d->files->selected(); | 484 | // qDebug(setDocFileRef); |
468 | } | 485 | // return dit; |
486 | // } | ||
487 | // } | ||
488 | // } else | ||
489 | switch (tabWidget->currentPageIndex()) { | ||
490 | case 0: //playlist | ||
491 | { | ||
492 | if ( mediaPlayerState->playlist() ) { | ||
493 | return d->selectedFiles->current(); | ||
494 | } | ||
495 | else if ( d->setDocumentUsed && d->current ) { | ||
496 | return d->current; | ||
497 | } else { | ||
498 | return d->files->selected(); | ||
499 | } | ||
500 | } | ||
501 | break; | ||
502 | case 1: { //audio | ||
503 | Global::findDocuments(&files, "audio/*"); | ||
504 | QListIterator<DocLnk> dit( files.children() ); | ||
505 | for ( ; dit.current(); ++dit ) { | ||
506 | if( dit.current()->name() == audioView->currentItem()->text(0)) | ||
507 | return dit; | ||
508 | } | ||
509 | } | ||
510 | break; | ||
511 | case 2: { // video | ||
512 | Global::findDocuments(&vFiles, "video/*"); | ||
513 | QListIterator<DocLnk> Vdit( vFiles.children() ); | ||
514 | for ( ; Vdit.current(); ++Vdit ) { | ||
515 | if( Vdit.current()->name() == videoView->currentItem()->text(0)) | ||
516 | return Vdit; | ||
517 | } | ||
518 | } | ||
519 | break; | ||
520 | }; | ||
469 | } | 521 | } |
470 | 522 | ||
471 | |||
472 | bool PlayListWidget::prev() { | 523 | bool PlayListWidget::prev() { |
473 | if ( mediaPlayerState->playlist() ) { | 524 | if ( mediaPlayerState->playlist() ) { |
474 | if ( mediaPlayerState->shuffled() ) { | 525 | if ( mediaPlayerState->shuffled() ) { |
@@ -569,10 +620,8 @@ void PlayListWidget::saveList() { | |||
569 | d->selectedFiles->first(); | 620 | d->selectedFiles->first(); |
570 | if(fileDlg) | 621 | if(fileDlg) |
571 | delete fileDlg; | 622 | delete fileDlg; |
572 | |||
573 | } | 623 | } |
574 | 624 | ||
575 | |||
576 | void PlayListWidget::loadList( const DocLnk & lnk) { | 625 | void PlayListWidget::loadList( const DocLnk & lnk) { |
577 | QString name= lnk.name(); | 626 | QString name= lnk.name(); |
578 | // qDebug("currentList is "+name); | 627 | // qDebug("currentList is "+name); |
@@ -589,7 +638,6 @@ void PlayListWidget::loadList( const DocLnk & lnk) { | |||
589 | } | 638 | } |
590 | } | 639 | } |
591 | 640 | ||
592 | |||
593 | void PlayListWidget::setPlaylist( bool shown ) { | 641 | void PlayListWidget::setPlaylist( bool shown ) { |
594 | if ( shown ) | 642 | if ( shown ) |
595 | d->playListFrame->show(); | 643 | d->playListFrame->show(); |
@@ -597,7 +645,6 @@ void PlayListWidget::setPlaylist( bool shown ) { | |||
597 | d->playListFrame->hide(); | 645 | d->playListFrame->hide(); |
598 | } | 646 | } |
599 | 647 | ||
600 | |||
601 | void PlayListWidget::setView( char view ) { | 648 | void PlayListWidget::setView( char view ) { |
602 | if ( view == 'l' ) | 649 | if ( view == 'l' ) |
603 | showMaximized(); | 650 | showMaximized(); |
@@ -704,68 +751,11 @@ void PlayListWidget::tabChanged(QWidget *widg) { | |||
704 | }; | 751 | }; |
705 | } | 752 | } |
706 | 753 | ||
707 | /* | ||
708 | list is right clicked*/ | ||
709 | void PlayListWidget::fauxPlay(QListViewItem *it) { | ||
710 | |||
711 | switch (tabWidget->currentPageIndex()) { | ||
712 | case 0: //playlist | ||
713 | break; | ||
714 | case 1: { //audio | ||
715 | QListIterator<DocLnk> dit( files.children() ); | ||
716 | for ( ; dit.current(); ++dit ) { | ||
717 | // qDebug(dit.current()->name()); | ||
718 | if( dit.current()->name() == it->text(0)) { | ||
719 | d->selectedFiles->addToSelection( **dit ); | ||
720 | } | ||
721 | } | ||
722 | } | ||
723 | break; | ||
724 | case 2: { // video | ||
725 | QListIterator<DocLnk> dit( vFiles.children() ); | ||
726 | for ( ; dit.current(); ++dit ) { | ||
727 | // qDebug(dit.current()->name()); | ||
728 | if( dit.current()->name() == it->text(0)) { | ||
729 | d->selectedFiles->addToSelection( **dit ); | ||
730 | } | ||
731 | } | ||
732 | } | ||
733 | break; | ||
734 | }; | ||
735 | mediaPlayerState->setPlaying( TRUE ); | ||
736 | // tabWidget->setCurrentPage(0); | ||
737 | d->selectedFiles->removeSelected(); | ||
738 | } | ||
739 | 754 | ||
740 | /* | 755 | /* |
741 | play button is pressed*/ | 756 | play button is pressed*/ |
742 | void PlayListWidget::btnPlay(bool b) { // this is fugly | 757 | void PlayListWidget::btnPlay(bool b) { |
743 | switch ( tabWidget->currentPageIndex()) { | 758 | mediaPlayerState->setPlaying(b); |
744 | case 0: | ||
745 | { | ||
746 | mediaPlayerState->setPlaying(b); | ||
747 | } | ||
748 | break; | ||
749 | case 1: | ||
750 | { | ||
751 | addToSelection( audioView->selectedItem() ); | ||
752 | mediaPlayerState->setPlaying(b); | ||
753 | qApp->processEvents(); | ||
754 | d->selectedFiles->removeSelected( ); | ||
755 | tabWidget->setCurrentPage(1); | ||
756 | } | ||
757 | break; | ||
758 | case 2: | ||
759 | { | ||
760 | addToSelection( videoView->selectedItem() ); | ||
761 | mediaPlayerState->setPlaying(b); | ||
762 | qApp->processEvents(); | ||
763 | d->selectedFiles->removeSelected( ); | ||
764 | tabWidget->setCurrentPage(2); | ||
765 | } | ||
766 | break; | ||
767 | }; | ||
768 | |||
769 | } | 759 | } |
770 | 760 | ||
771 | void PlayListWidget::deletePlaylist() { | 761 | void PlayListWidget::deletePlaylist() { |
@@ -782,3 +772,43 @@ void PlayListWidget::deletePlaylist() { | |||
782 | }; | 772 | }; |
783 | 773 | ||
784 | } | 774 | } |
775 | |||
776 | void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) | ||
777 | { | ||
778 | switch (mouse) { | ||
779 | case 1: | ||
780 | break; | ||
781 | case 2:{ | ||
782 | QPopupMenu m; | ||
783 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); | ||
784 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | ||
785 | // m.insertSeparator(); | ||
786 | // m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | ||
787 | m.exec( QCursor::pos() ); | ||
788 | } | ||
789 | break; | ||
790 | }; | ||
791 | |||
792 | } | ||
793 | |||
794 | void PlayListWidget::playSelected() | ||
795 | { | ||
796 | btnPlay( TRUE); | ||
797 | } | ||
798 | |||
799 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) | ||
800 | { | ||
801 | switch (mouse) { | ||
802 | case 1: | ||
803 | break; | ||
804 | case 2:{ | ||
805 | QPopupMenu m; | ||
806 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | ||
807 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); | ||
808 | // m.insertSeparator(); | ||
809 | m.exec( QCursor::pos() ); | ||
810 | } | ||
811 | break; | ||
812 | }; | ||
813 | |||
814 | } | ||
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h index e72551b..effc600 100644 --- a/core/multimedia/opieplayer/playlistwidget.h +++ b/core/multimedia/opieplayer/playlistwidget.h | |||
@@ -43,11 +43,13 @@ public: | |||
43 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); | 43 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); |
44 | ~PlayListWidget(); | 44 | ~PlayListWidget(); |
45 | QTabWidget * tabWidget; | 45 | QTabWidget * tabWidget; |
46 | QAction *fullScreenButton, *scaleButton; | 46 | QAction *fullScreenButton, *scaleButton; |
47 | DocLnkSet files; | 47 | DocLnkSet files; |
48 | DocLnkSet vFiles; | 48 | DocLnkSet vFiles; |
49 | QListView *audioView, *videoView, *playlistView; | 49 | QListView *audioView, *videoView, *playlistView; |
50 | QLabel *libString; | 50 | QLabel *libString; |
51 | bool fromSetDocument; | ||
52 | QString setDocFileRef; | ||
51 | // retrieve the current playlist entry (media file link) | 53 | // retrieve the current playlist entry (media file link) |
52 | const DocLnk *current(); | 54 | const DocLnk *current(); |
53 | void useSelectedDocument(); | 55 | void useSelectedDocument(); |
@@ -68,7 +70,7 @@ public slots: | |||
68 | void saveList(); // Save the playlist | 70 | void saveList(); // Save the playlist |
69 | void loadList( const DocLnk &); // Load a playlist | 71 | void loadList( const DocLnk &); // Load a playlist |
70 | void playIt( QListViewItem *); | 72 | void playIt( QListViewItem *); |
71 | void fauxPlay(QListViewItem *); | 73 | |
72 | void btnPlay(bool); | 74 | void btnPlay(bool); |
73 | void deletePlaylist(); | 75 | void deletePlaylist(); |
74 | bool first(); | 76 | bool first(); |
@@ -78,6 +80,9 @@ public slots: | |||
78 | void addSelected(); | 80 | void addSelected(); |
79 | void removeSelected(); | 81 | void removeSelected(); |
80 | void tabChanged(QWidget*); | 82 | void tabChanged(QWidget*); |
83 | void viewPressed( int, QListViewItem *, const QPoint&, int); | ||
84 | void playlistViewPressed( int, QListViewItem *, const QPoint&, int); | ||
85 | void playSelected(); | ||
81 | /* void setFullScreen(); */ | 86 | /* void setFullScreen(); */ |
82 | /* void setScaled(); */ | 87 | /* void setScaled(); */ |
83 | protected: | 88 | protected: |
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index be838c4..bb5f9e8 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp | |||
@@ -184,36 +184,36 @@ void VideoWidget::paintButton( QPainter *p, int i ) { | |||
184 | 184 | ||
185 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 185 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
186 | for ( int i = 0; i < numButtons; i++ ) { | 186 | for ( int i = 0; i < numButtons; i++ ) { |
187 | int x = videoButtons[i].xPos; | 187 | int x = videoButtons[i].xPos; |
188 | int y = videoButtons[i].yPos; | 188 | int y = videoButtons[i].yPos; |
189 | if ( event->state() == QMouseEvent::LeftButton ) { | 189 | if ( event->state() == QMouseEvent::LeftButton ) { |
190 | // The test to see if the mouse click is inside the circular button or not | 190 | // The test to see if the mouse click is inside the circular button or not |
191 | // (compared with the radius squared to avoid a square-root of our distance) | 191 | // (compared with the radius squared to avoid a square-root of our distance) |
192 | int radius = 16; | 192 | int radius = 16; |
193 | QPoint center = QPoint( x + radius, y + radius ); | 193 | QPoint center = QPoint( x + radius, y + radius ); |
194 | QPoint dXY = center - event->pos(); | 194 | QPoint dXY = center - event->pos(); |
195 | int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); | 195 | int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); |
196 | bool isOnButton = dist <= (radius * radius); | 196 | bool isOnButton = dist <= (radius * radius); |
197 | if ( isOnButton != videoButtons[i].isHeld ) { | 197 | if ( isOnButton != videoButtons[i].isHeld ) { |
198 | videoButtons[i].isHeld = isOnButton; | 198 | videoButtons[i].isHeld = isOnButton; |
199 | toggleButton(i); | 199 | toggleButton(i); |
200 | } | 200 | } |
201 | } else { | 201 | } else { |
202 | if ( videoButtons[i].isHeld ) { | 202 | if ( videoButtons[i].isHeld ) { |
203 | videoButtons[i].isHeld = FALSE; | 203 | videoButtons[i].isHeld = FALSE; |
204 | if ( !videoButtons[i].isToggle ) | 204 | if ( !videoButtons[i].isToggle ) |
205 | setToggleButton( i, FALSE ); | 205 | setToggleButton( i, FALSE ); |
206 | switch (i) { | 206 | switch (i) { |
207 | case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; | 207 | case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; |
208 | case VideoStop: mediaPlayerState->setPlaying(FALSE); return; | 208 | case VideoStop: mediaPlayerState->setPlaying(FALSE); return; |
209 | case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; | 209 | case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; |
210 | case VideoNext: mediaPlayerState->setNext(); return; | 210 | case VideoNext: mediaPlayerState->setNext(); return; |
211 | case VideoPrevious: mediaPlayerState->setPrev(); return; | 211 | case VideoPrevious: mediaPlayerState->setPrev(); return; |
212 | case VideoPlayList: mediaPlayerState->setList(); return; | 212 | case VideoPlayList: mediaPlayerState->setList(); return; |
213 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 213 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
214 | } | 214 | } |
215 | } | 215 | } |
216 | } | 216 | } |
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
@@ -227,7 +227,7 @@ void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | |||
227 | if ( mediaPlayerState->fullscreen() ) { | 227 | if ( mediaPlayerState->fullscreen() ) { |
228 | mediaPlayerState->setFullscreen( FALSE ); | 228 | mediaPlayerState->setFullscreen( FALSE ); |
229 | makeVisible(); | 229 | makeVisible(); |
230 | } else { | 230 | |
231 | mouseMoveEvent( event ); | 231 | mouseMoveEvent( event ); |
232 | } | 232 | } |
233 | } | 233 | } |
@@ -421,3 +421,51 @@ bool VideoWidget::playVideo() { | |||
421 | } | 421 | } |
422 | 422 | ||
423 | 423 | ||
424 | |||
425 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) | ||
426 | { | ||
427 | switch ( e->key() ) { | ||
428 | ////////////////////////////// Zaurus keys | ||
429 | case Key_Home: | ||
430 | break; | ||
431 | case Key_F9: //activity | ||
432 | break; | ||
433 | case Key_F10: //contacts | ||
434 | break; | ||
435 | case Key_F11: //menu | ||
436 | break; | ||
437 | case Key_F12: //home | ||
438 | break; | ||
439 | case Key_F13: //mail | ||
440 | break; | ||
441 | case Key_Space: { | ||
442 | if(mediaPlayerState->playing()) { | ||
443 | mediaPlayerState->setPlaying(FALSE); | ||
444 | } else { | ||
445 | mediaPlayerState->setPlaying(TRUE); | ||
446 | } | ||
447 | } | ||
448 | break; | ||
449 | case Key_Down: | ||
450 | // toggleButton(6); | ||
451 | // emit lessClicked(); | ||
452 | // emit lessReleased(); | ||
453 | // toggleButton(6); | ||
454 | break; | ||
455 | case Key_Up: | ||
456 | // toggleButton(5); | ||
457 | // emit moreClicked(); | ||
458 | // emit moreReleased(); | ||
459 | // toggleButton(5); | ||
460 | break; | ||
461 | case Key_Right: | ||
462 | mediaPlayerState->setNext(); | ||
463 | break; | ||
464 | case Key_Left: | ||
465 | mediaPlayerState->setPrev(); | ||
466 | break; | ||
467 | case Key_Escape: | ||
468 | break; | ||
469 | |||
470 | }; | ||
471 | } | ||
diff --git a/core/multimedia/opieplayer/videowidget.h b/core/multimedia/opieplayer/videowidget.h index cf13743..fe56ca1 100644 --- a/core/multimedia/opieplayer/videowidget.h +++ b/core/multimedia/opieplayer/videowidget.h | |||
@@ -67,6 +67,7 @@ protected: | |||
67 | void mousePressEvent( QMouseEvent *event ); | 67 | void mousePressEvent( QMouseEvent *event ); |
68 | void mouseReleaseEvent( QMouseEvent *event ); | 68 | void mouseReleaseEvent( QMouseEvent *event ); |
69 | void closeEvent( QCloseEvent *event ); | 69 | void closeEvent( QCloseEvent *event ); |
70 | void keyReleaseEvent( QKeyEvent *e); | ||
70 | 71 | ||
71 | private: | 72 | private: |
72 | void paintButton( QPainter *p, int i ); | 73 | void paintButton( QPainter *p, int i ); |
@@ -76,7 +77,7 @@ private: | |||
76 | QSlider *slider; | 77 | QSlider *slider; |
77 | QPixmap *pixmaps[3]; | 78 | QPixmap *pixmaps[3]; |
78 | QImage *currentFrame; | 79 | QImage *currentFrame; |
79 | intscaledWidth; | 80 | int scaledWidth; |
80 | int scaledHeight; | 81 | int scaledHeight; |
81 | }; | 82 | }; |
82 | 83 | ||