-rw-r--r-- | core/multimedia/opieplayer/audiowidget.cpp | 32 | ||||
-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 | 12 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 28 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.h | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 1 |
9 files changed, 65 insertions, 19 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 @@ -25,6 +25,7 @@ #include <qbutton.h> #include <qpainter.h> #include <qframe.h> +#include <qlayout.h> #include "audiowidget.h" #include "mediaplayerstate.h" @@ -63,8 +64,12 @@ 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" ) ); @@ -73,8 +78,9 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : songInfo = new Ticker( this ); songInfo->setFocusPolicy( QWidget::NoFocus ); - songInfo->setGeometry( QRect( 7, 3, 220, 20 ) ); - + 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 ); @@ -83,6 +89,7 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : 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() ) ); @@ -104,6 +111,7 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : AudioWidget::~AudioWidget() { + mediaPlayerState->isStreaming = FALSE; for ( int i = 0; i < 4; i++ ) delete pixmaps[i]; } @@ -137,6 +145,7 @@ void AudioWidget::setLength( long max ) { void AudioWidget::setView( char view ) { + if (mediaPlayerState->isStreaming) { if( !slider->isHidden()) slider->hide(); disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); @@ -144,17 +153,18 @@ void AudioWidget::setView( char view ) { } 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 ); - showMaximized(); + startTimer( 150 ); +// show(); + showMaximized(); } else { - killTimers(); - hide(); + killTimers(); + hide(); } } @@ -290,7 +300,9 @@ void AudioWidget::paintEvent( QPaintEvent * ) { paintButton( &p, i ); } - +void AudioWidget::showMe() { + show(); +} void AudioWidget::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { @@ -298,6 +310,8 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) case Key_Home: break; case Key_F9: //activity + hide(); +// qDebug("Audio F9"); break; case Key_F10: //contacts break; 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 @@ -130,7 +130,7 @@ protected: void timerEvent( QTimerEvent *event ); void closeEvent( QCloseEvent *event ); void keyReleaseEvent( QKeyEvent *e); - + void showMe(); private: void toggleButton( int ); void setToggleButton( int, bool ); 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 @@ -435,9 +435,6 @@ 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 ) ) ); 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 @@ -45,6 +45,7 @@ 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 ) ) ); @@ -59,6 +60,8 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) MediaPlayer::~MediaPlayer() { + QPEApplication::grabKeyboard(); + QPEApplication::ungrabKeyboard(); } 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 @@ -47,6 +47,7 @@ private slots: protected: void timerEvent( QTimerEvent *e ); +// void keyReleaseEvent( QKeyEvent *e); private: int volumeDirection; 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 @@ -98,11 +98,15 @@ MediaPlayerDecoder *MediaPlayerState::newDecoder( const QString& file ) { MediaPlayerDecoder *tmpDecoder = NULL; QValueList<MediaPlayerPlugin>::Iterator it; for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { - if ( (*it).decoder->isFileSupported( file ) ) { - tmpDecoder = (*it).decoder; - break; - } + if ( (*it).decoder->isFileSupported( file ) ) { + tmpDecoder = (*it).decoder; + break; + } } + if(file.left(4)=="http") + isStreaming = TRUE; + else + isStreaming = FALSE; return decoder = tmpDecoder; } 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 @@ -59,11 +59,15 @@ #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 { @@ -201,7 +205,8 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 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)), + + connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); @@ -740,7 +745,9 @@ void PlayListWidget::removeSelected() { void PlayListWidget::playIt( QListViewItem *it) { // d->setDocumentUsed = FALSE; + mediaPlayerState->setPlaying(FALSE); mediaPlayerState->setPlaying(TRUE); + d->selectedFiles->unSelect(); } void PlayListWidget::addToSelection( QListViewItem *it) { @@ -880,12 +887,14 @@ 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; @@ -1038,3 +1047,20 @@ void PlayListWidget::openFile() { 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 @@ -67,7 +67,7 @@ public slots: protected: /* void contentsMousePressEvent( QMouseEvent * e ); */ /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ - +void keyReleaseEvent( QKeyEvent *e); private: void initializeStates(); void readConfig( Config& cfg ); 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 @@ -432,6 +432,7 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) case Key_F9: //activity break; case Key_F10: //contacts + hide(); break; case Key_F11: //menu break; |