-rw-r--r-- | core/multimedia/opieplayer/audiowidget.cpp | 20 | ||||
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.h | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol.cpp | 3 | ||||
-rw-r--r-- | core/multimedia/opieplayer/mediaplayer.cpp | 3 | ||||
-rw-r--r-- | core/multimedia/opieplayer/mediaplayer.h | 1 | ||||
-rw-r--r-- | core/multimedia/opieplayer/mediaplayerstate.cpp | 4 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 26 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.h | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 1 |
9 files changed, 54 insertions, 8 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index e2e3603..94b979f 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp @@ -22,12 +22,13 @@ #include <qwidget.h> #include <qpixmap.h> #include <qbutton.h> #include <qpainter.h> #include <qframe.h> +#include <qlayout.h> #include "audiowidget.h" #include "mediaplayerstate.h" extern MediaPlayerState *mediaPlayerState; @@ -60,32 +61,38 @@ MediaButton audioButtons[] = { static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : QWidget( parent, name, f ) { -// QPEApplication::grabKeyboard(); setCaption( tr("OpiePlayer") ); + +// QGridLayout *layout = new QGridLayout( this ); +// layout->setSpacing( 2); +// layout->setMargin( 2); + setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); pixmaps[0] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButtonsAll" ) ); pixmaps[1] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButtonsBig" ) ); pixmaps[2] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaControls" ) ); pixmaps[3] = new QPixmap( Resource::loadPixmap( "opieplayer/animatedButton" ) ); songInfo = new Ticker( this ); songInfo->setFocusPolicy( QWidget::NoFocus ); songInfo->setGeometry( QRect( 7, 3, 220, 20 ) ); +// layout->addMultiCellWidget( songInfo, 0, 0, 0, 2 ); slider = new QSlider( Qt::Horizontal, this ); slider->setFixedWidth( 220 ); slider->setFixedHeight( 20 ); slider->setMinValue( 0 ); slider->setMaxValue( 1 ); slider->setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); slider->setFocusPolicy( QWidget::NoFocus ); slider->setGeometry( QRect( 7, 262, 220, 20 ) ); + // layout->addMultiCellWidget( slider, 4, 4, 0, 2 ); connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); @@ -101,12 +108,13 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : setPlaying( mediaPlayerState->playing() ); } AudioWidget::~AudioWidget() { + mediaPlayerState->isStreaming = FALSE; for ( int i = 0; i < 4; i++ ) delete pixmaps[i]; } static bool audioSliderBeingMoved = FALSE; @@ -134,26 +142,28 @@ void AudioWidget::setPosition( long i ) { void AudioWidget::setLength( long max ) { updateSlider( mediaPlayerState->position(), max ); } void AudioWidget::setView( char view ) { + if (mediaPlayerState->isStreaming) { if( !slider->isHidden()) slider->hide(); disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); } else { // this stops the slider from being moved, thus // does not stop stream when it reaches the end - if( slider->isHidden()) slider->show(); + slider->show(); connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); } if ( view == 'a' ) { startTimer( 150 ); +// show(); showMaximized(); } else { killTimers(); hide(); } } @@ -287,20 +297,24 @@ void AudioWidget::closeEvent( QCloseEvent* ) { void AudioWidget::paintEvent( QPaintEvent * ) { QPainter p( this ); for ( int i = 0; i < numButtons; i++ ) paintButton( &p, i ); } - +void AudioWidget::showMe() { + show(); +} void AudioWidget::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_Home: break; case Key_F9: //activity + hide(); +// qDebug("Audio F9"); break; case Key_F10: //contacts break; case Key_F11: //menu break; case Key_F12: //home diff --git a/core/multimedia/opieplayer/audiowidget.h b/core/multimedia/opieplayer/audiowidget.h index 4ffd167..41ae4b6 100644 --- a/core/multimedia/opieplayer/audiowidget.h +++ b/core/multimedia/opieplayer/audiowidget.h @@ -127,13 +127,13 @@ protected: void mouseMoveEvent( QMouseEvent *event ); void mousePressEvent( QMouseEvent *event ); void mouseReleaseEvent( QMouseEvent *event ); void timerEvent( QTimerEvent *event ); void closeEvent( QCloseEvent *event ); void keyReleaseEvent( QKeyEvent *e); - + void showMe(); private: void toggleButton( int ); void setToggleButton( int, bool ); void paintButton( QPainter *p, int i ); QPixmap *pixmaps[4]; Ticker *songInfo; diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp index 7005886..faa8e56 100644 --- a/core/multimedia/opieplayer/loopcontrol.cpp +++ b/core/multimedia/opieplayer/loopcontrol.cpp @@ -432,15 +432,12 @@ bool LoopControl::init( const QString& filename ) { } current_frame = 0; prev_frame = -1; - if( fileName.left(7) == "http://") - mediaPlayerState->isStreaming = TRUE; - connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( setPosition( long ) ) ); connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( setPaused( bool ) ) ); audioMutex->unlock(); return TRUE; diff --git a/core/multimedia/opieplayer/mediaplayer.cpp b/core/multimedia/opieplayer/mediaplayer.cpp index e0c4dba..ab46a7d 100644 --- a/core/multimedia/opieplayer/mediaplayer.cpp +++ b/core/multimedia/opieplayer/mediaplayer.cpp @@ -42,12 +42,13 @@ extern PlayListWidget *playList; extern LoopControl *loopControl; extern MediaPlayerState *mediaPlayerState; MediaPlayer::MediaPlayer( QObject *parent, const char *name ) : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { + QPEApplication::grabKeyboard(); connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); @@ -56,12 +57,14 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); } MediaPlayer::~MediaPlayer() { + QPEApplication::grabKeyboard(); + QPEApplication::ungrabKeyboard(); } void MediaPlayer::pauseCheck( bool b ) { // Only pause if playing if ( b && !mediaPlayerState->playing() ) diff --git a/core/multimedia/opieplayer/mediaplayer.h b/core/multimedia/opieplayer/mediaplayer.h index d6e90cb..0354d21 100644 --- a/core/multimedia/opieplayer/mediaplayer.h +++ b/core/multimedia/opieplayer/mediaplayer.h @@ -44,12 +44,13 @@ private slots: void startIncreasingVolume(); void startDecreasingVolume(); void stopChangingVolume(); protected: void timerEvent( QTimerEvent *e ); +// void keyReleaseEvent( QKeyEvent *e); private: int volumeDirection; const DocLnk *currentFile; }; diff --git a/core/multimedia/opieplayer/mediaplayerstate.cpp b/core/multimedia/opieplayer/mediaplayerstate.cpp index 4e14436..3ac9ac4 100644 --- a/core/multimedia/opieplayer/mediaplayerstate.cpp +++ b/core/multimedia/opieplayer/mediaplayerstate.cpp @@ -100,12 +100,16 @@ MediaPlayerDecoder *MediaPlayerState::newDecoder( const QString& file ) { for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { if ( (*it).decoder->isFileSupported( file ) ) { tmpDecoder = (*it).decoder; break; } } + if(file.left(4)=="http") + isStreaming = TRUE; + else + isStreaming = FALSE; return decoder = tmpDecoder; } MediaPlayerDecoder *MediaPlayerState::curDecoder() { return decoder; diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 7c76400..faa6e3f 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp @@ -56,17 +56,21 @@ #include "playlistwidget.h" #include "mediaplayerstate.h" #include "inputDialog.h" #include <stdlib.h> +#include "audiowidget.h" +#include "videowidget.h" #define BUTTONS_ON_TOOLBAR #define SIDE_BUTTONS #define CAN_SAVE_LOAD_PLAYLISTS +extern AudioWidget *audioUI; +extern VideoWidget *videoUI; extern MediaPlayerState *mediaPlayerState; // class myFileSelector { // }; class PlayListWidgetPrivate { @@ -198,12 +202,13 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); d->selectedFiles = new PlayListSelection( hbox2); QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); + connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); @@ -737,13 +742,15 @@ void PlayListWidget::addSelected() { void PlayListWidget::removeSelected() { d->selectedFiles->removeSelected( ); } void PlayListWidget::playIt( QListViewItem *it) { // d->setDocumentUsed = FALSE; + mediaPlayerState->setPlaying(FALSE); mediaPlayerState->setPlaying(TRUE); + d->selectedFiles->unSelect(); } void PlayListWidget::addToSelection( QListViewItem *it) { d->setDocumentUsed = FALSE; if(it) { @@ -877,18 +884,20 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& }; } void PlayListWidget::playSelected() { btnPlay( TRUE); + d->selectedFiles->unSelect(); } void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) { switch (mouse) { case 1: + break; case 2:{ QPopupMenu m; m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); // m.insertSeparator(); @@ -1035,6 +1044,23 @@ void PlayListWidget::openFile() { // delete fileDlg2; } if(fileDlg) delete fileDlg; } + +void PlayListWidget::keyReleaseEvent( QKeyEvent *e) +{ + switch ( e->key() ) { +////////////////////////////// Zaurus keys + case Key_F9: //activity + if(audioUI->isHidden()) + audioUI->showMaximized(); + break; + case Key_F10: //contacts + if( videoUI->isHidden()) + videoUI->showMaximized(); + + break; + + } +} diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h index 02cdba6..16b9905 100644 --- a/core/multimedia/opieplayer/playlistwidget.h +++ b/core/multimedia/opieplayer/playlistwidget.h @@ -64,13 +64,13 @@ public slots: bool prev(); /* void setFullScreen(); */ /* void setScaled(); */ protected: /* void contentsMousePressEvent( QMouseEvent * e ); */ /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ - +void keyReleaseEvent( QKeyEvent *e); private: void initializeStates(); void readConfig( Config& cfg ); void writeConfig( Config& cfg ) const; PlayListWidgetPrivate *d; // Private implementation data void populateAudioView(); diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index 70b4a95..d0cb764 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp @@ -429,12 +429,13 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) ////////////////////////////// Zaurus keys case Key_Home: break; case Key_F9: //activity break; case Key_F10: //contacts + hide(); break; case Key_F11: //menu break; case Key_F12: //home break; case Key_F13: //mail |