summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp32
-rw-r--r--core/multimedia/opieplayer/audiowidget.h2
-rw-r--r--core/multimedia/opieplayer/loopcontrol.cpp3
-rw-r--r--core/multimedia/opieplayer/mediaplayer.cpp3
-rw-r--r--core/multimedia/opieplayer/mediaplayer.h1
-rw-r--r--core/multimedia/opieplayer/mediaplayerstate.cpp12
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp28
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h2
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp1
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
@@ -20,16 +20,17 @@
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#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;
static const int xo = -2; // movable x offset
@@ -58,36 +59,42 @@ 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 ) );
-
+ 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) ) );
connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
@@ -99,16 +106,17 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
setLooping( mediaPlayerState->fullscreen() );
setPaused( mediaPlayerState->paused() );
setPlaying( mediaPlayerState->playing() );
}
AudioWidget::~AudioWidget() {
+ mediaPlayerState->isStreaming = FALSE;
for ( int i = 0; i < 4; i++ )
delete pixmaps[i];
}
static bool audioSliderBeingMoved = FALSE;
@@ -132,34 +140,36 @@ 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 );
- showMaximized();
+ startTimer( 150 );
+// show();
+ showMaximized();
} else {
- killTimers();
- hide();
+ killTimers();
+ hide();
}
}
void AudioWidget::updateSlider( long i, long max ) {
if ( max == 0 )
return;
// Will flicker too much if we don't do this
@@ -285,24 +295,28 @@ 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
break;
case Key_F13: //mail
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
@@ -125,17 +125,17 @@ protected:
void paintEvent( QPaintEvent *pe );
void showEvent( QShowEvent *se );
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;
QSlider *slider;
};
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
@@ -430,19 +430,16 @@ bool LoopControl::init( const QString& filename ) {
DecodeLoopDebug(( "Cannot seek to frame" ));
}
}
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
@@ -40,30 +40,33 @@
extern AudioWidget *audioUI;
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() ) );
connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
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() )
mediaPlayerState->setPaused( FALSE );
}
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
@@ -42,16 +42,17 @@ private slots:
void next();
void prev();
void startIncreasingVolume();
void startDecreasingVolume();
void stopChangingVolume();
protected:
void timerEvent( QTimerEvent *e );
+// void keyReleaseEvent( QKeyEvent *e);
private:
int volumeDirection;
const DocLnk *currentFile;
};
#endif // MEDIA_PLAYER_H
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
@@ -93,21 +93,25 @@ struct MediaPlayerPlugin {
static QValueList<MediaPlayerPlugin> pluginList;
// Find the first decoder which supports this type of file
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;
}
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
@@ -54,21 +54,25 @@
#include "playlistselection.h"
#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 {
public:
QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
@@ -196,17 +200,18 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
d->playListFrame ->setMinimumSize(235,260);
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)),
+
+ 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()) );
new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) );
new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) );
QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
@@ -735,17 +740,19 @@ 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) {
switch (tabWidget->currentPageIndex()) {
case 1: {
@@ -875,22 +882,24 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint&
}
break;
};
}
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();
m.exec( QCursor::pos() );
}
@@ -1033,8 +1042,25 @@ void PlayListWidget::openFile() {
d->selectedFiles->addToSelection( lnk);
// if(fileDlg2)
// 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
@@ -62,17 +62,17 @@ public slots:
bool last();
bool next();
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();
void populateVideoView();
private slots:
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
@@ -427,16 +427,17 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e)
{
switch ( e->key() ) {
////////////////////////////// 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
break;
case Key_Space: {