author | llornkcor <llornkcor> | 2002-08-03 14:19:05 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-08-03 14:19:05 (UTC) |
commit | aa06a62511cabebeaad1d3dda34b30640f967dea (patch) (side-by-side diff) | |
tree | a6887240b094f46de46b743135a2e918ba3254ad | |
parent | d3c13036415713932f1706e46fa7c99ef38188df (diff) | |
download | opie-aa06a62511cabebeaad1d3dda34b30640f967dea.zip opie-aa06a62511cabebeaad1d3dda34b30640f967dea.tar.gz opie-aa06a62511cabebeaad1d3dda34b30640f967dea.tar.bz2 |
audiowidget now shows time and slider moves.
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/opieplayer2.pro | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 9 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.h | 5 |
7 files changed, 22 insertions, 20 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 303834a..23f4329 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -206,145 +206,145 @@ QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) void AudioWidget::resizeEvent( QResizeEvent * ) { int h = height(); int w = width(); songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); slider.setFixedWidth( w - 110 ); slider.setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); slider.setBackgroundOrigin( QWidget::ParentOrigin ); time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); xoff = ( w - imgUp->width() ) / 2; yoff = (( h - imgUp->height() ) / 2) - 10; QPoint p( xoff, yoff ); QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p ); QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p ); for ( int i = 0; i < 11; i++ ) { if ( !masks[i]->isNull() ) { delete buttonPixUp[i]; delete buttonPixDown[i]; buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] ); buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] ); } } delete pixUp; delete pixDn; } static bool audioSliderBeingMoved = FALSE; void AudioWidget::sliderPressed() { audioSliderBeingMoved = TRUE; } void AudioWidget::sliderReleased() { audioSliderBeingMoved = FALSE; if ( slider.width() == 0 ) return; long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); mediaPlayerState->setPosition( val ); } void AudioWidget::setPosition( long i ) { - qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); +// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); updateSlider( i, mediaPlayerState->length() ); } void AudioWidget::setLength( long max ) { updateSlider( mediaPlayerState->position(), max ); } void AudioWidget::setView( char view ) { slider.show(); // this isnt working for some reason // if ( mediaPlayerState->streaming() ) { // qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); // 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 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(); } else { killTimers(); hide(); } } static QString timeAsString( long length ) { - length /= 44100; int minutes = length / 60; int seconds = length % 60; return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); } void AudioWidget::updateSlider( long i, long max ) { time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); - +// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; + if ( max == 0 ) { return; } // Will flicker too much if we don't do this // Scale to something reasonable int width = slider.width(); int val = int((double)i * width / max); if ( !audioSliderBeingMoved ) { if ( slider.value() != val ) { slider.setValue( val ); } if ( slider.maxValue() != width ) { slider.setMaxValue( width ); } } } void AudioWidget::setToggleButton( int i, bool down ) { if ( down != audioButtons[i].isDown ) { toggleButton( i ); } } void AudioWidget::toggleButton( int i ) { audioButtons[i].isDown = !audioButtons[i].isDown; QPainter p(this); paintButton ( &p, i ); } void AudioWidget::paintButton( QPainter *p, int i ) { if ( audioButtons[i].isDown ) p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); else p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); } void AudioWidget::timerEvent( QTimerEvent * ) { // static int frame = 0; // if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) { // frame = frame >= 7 ? 0 : frame + 1; // } } diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 778cd1e..135c67c 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp @@ -64,96 +64,97 @@ bool MediaPlayerState::streaming() { bool MediaPlayerState::fullscreen() { return isFullscreen; } bool MediaPlayerState::scaled() { return isScaled; } bool MediaPlayerState::looping() { return isLooping; } bool MediaPlayerState::shuffled() { return isShuffled; } bool MediaPlayerState:: playlist() { return usePlaylist; } bool MediaPlayerState::paused() { return isPaused; } bool MediaPlayerState::playing() { return isPlaying; } bool MediaPlayerState::stop() { return isStoped; } long MediaPlayerState::position() { return curPosition; } long MediaPlayerState::length() { return curLength; } char MediaPlayerState::view() { return curView; } // slots void MediaPlayerState::setIsStreaming( bool b ) { + if ( isStreaming == b ) { return; } isStreaming = b; } void MediaPlayerState::setFullscreen( bool b ) { if ( isFullscreen == b ) { return; } isFullscreen = b; emit fullscreenToggled(b); } void MediaPlayerState::setScaled( bool b ) { if ( isScaled == b ) { return; } isScaled = b; emit scaledToggled(b); } void MediaPlayerState::setLooping( bool b ) { if ( isLooping == b ) { return; } isLooping = b; emit loopingToggled(b); } void MediaPlayerState::setShuffled( bool b ) { if ( isShuffled == b ) { return; } isShuffled = b; emit shuffledToggled(b); } void MediaPlayerState::setPlaylist( bool b ) { if ( usePlaylist == b ) { return; } usePlaylist = b; emit playlistToggled(b); } diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index 79ba579..887c527 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h @@ -3,130 +3,130 @@ Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef MEDIA_PLAYER_STATE_H #define MEDIA_PLAYER_STATE_H #include <qobject.h> class MediaPlayerDecoder; class Config; class MediaPlayerState : public QObject { Q_OBJECT public: MediaPlayerState( QObject *parent, const char *name ); ~MediaPlayerState(); + bool isPaused; + bool isPlaying; + bool isStoped; bool streaming(); bool fullscreen(); bool scaled(); bool looping(); bool shuffled(); bool playlist(); bool paused(); bool playing(); bool stop(); long position(); long length(); char view(); public slots: void setIsStreaming( bool b ); void setFullscreen( bool b ); void setScaled( bool b ); void setLooping( bool b ); void setShuffled( bool b ); void setPlaylist( bool b ); void setPaused( bool b ); void setPlaying( bool b ); void setStop( bool b ); void setPosition( long p ); void updatePosition( long p ); void setLength( long l ); void setView( char v ); void setPrev(); void setNext(); void setList(); void setVideo(); void setAudio(); void toggleFullscreen(); void toggleScaled(); void toggleLooping(); void toggleShuffled(); void togglePlaylist(); void togglePaused(); void togglePlaying(); signals: void fullscreenToggled( bool ); void scaledToggled( bool ); void loopingToggled( bool ); void shuffledToggled( bool ); void playlistToggled( bool ); void pausedToggled( bool ); void playingToggled( bool ); void stopToggled( bool ); void positionChanged( long ); // When the slider is moved void positionUpdated( long ); // When the media file progresses void lengthChanged( long ); void viewChanged( char ); void prev(); void next(); private: bool isStreaming; bool isFullscreen; bool isScaled; bool isLooping; bool isShuffled; bool usePlaylist; - bool isPaused; - bool isPlaying; - bool isStoped; long curPosition; long curLength; char curView; void readConfig( Config& cfg ); void writeConfig( Config& cfg ) const; }; #endif // MEDIA_PLAYER_STATE_H diff --git a/noncore/multimedia/opieplayer2/opieplayer2.pro b/noncore/multimedia/opieplayer2/opieplayer2.pro index 448dd34..d8cacd0 100644 --- a/noncore/multimedia/opieplayer2/opieplayer2.pro +++ b/noncore/multimedia/opieplayer2/opieplayer2.pro @@ -1,21 +1,23 @@ TEMPLATE = app CONFIG = qt warn_on release #release DESTDIR = $(OPIEDIR)/bin HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\ - videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \ - frame.h lib.h xinevideowidget.h \ + videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \ + frame.h lib.h xinevideowidget.h \ alphablend.h yuv2rgb.h SOURCES = main.cpp \ - playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp mediadetect.cpp\ - videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp \ - frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp \ + playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp mediadetect.cpp\ + videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp \ + frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp \ alphablend.c yuv2rgb.c yuv2rgb_mlib.c yuv2rgb_mmx.c TARGET = opieplayer2 INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lpthread -lopie -lxine -lxineutils +MOC_DIR=qpeobj +OBJECTS_DIR=qpeobj INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index cce445b..1dee422 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -127,97 +127,97 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) QPEToolBar *bar = new QPEToolBar( this ); bar->setLabel( tr( "Play Operations" ) ); tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); tbDeletePlaylist->setFlat(TRUE); tbDeletePlaylist->setFixedSize(20,20); d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", this , SLOT(addSelected()) ); d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", this , SLOT(removeSelected()) ); d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", this , SLOT( btnPlay(bool) ), TRUE ); d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", mediaPlayerState, SLOT(setLooping(bool)), TRUE ); tbDeletePlaylist->hide(); QPopupMenu *pmPlayList = new QPopupMenu( this ); menu->insertItem( tr( "File" ), pmPlayList ); new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); pmPlayList->insertSeparator(-1); new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) ); pmPlayList->insertSeparator(-1); new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); pmPlayList->insertSeparator(-1); new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); QPopupMenu *pmView = new QPopupMenu( this ); menu->insertItem( tr( "View" ), pmView ); fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); fullScreenButton->addTo(pmView); scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); scaleButton->addTo(pmView); QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); tabWidget = new QTabWidget( hbox6, "tabWidget" ); - tabWidget->setTabShape(QTabWidget::Triangular); +// tabWidget->setTabShape(QTabWidget::Triangular); QWidget *pTab; pTab = new QWidget( tabWidget, "pTab" ); tabWidget->insertTab( pTab,"Playlist"); // Add the playlist area QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); d->playListFrame = vbox3; 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); 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 QWidget *aTab; aTab = new QWidget( tabWidget, "aTab" ); audioView = new QListView( aTab, "Audioview" ); audioView->setMinimumSize(233,260); audioView->addColumn( tr("Title"),140); audioView->addColumn(tr("Size"), -1); audioView->addColumn(tr("Media"),-1); audioView->setColumnAlignment(1, Qt::AlignRight); audioView->setColumnAlignment(2, Qt::AlignRight); audioView->setAllColumnsShowFocus(TRUE); audioView->setMultiSelection( TRUE ); audioView->setSelectionMode( QListView::Extended); tabWidget->insertTab(aTab,tr("Audio")); QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); QWidget *vTab; vTab = new QWidget( tabWidget, "vTab" ); videoView = new QListView( vTab, "Videoview" ); videoView->setMinimumSize(233,260); @@ -381,96 +381,97 @@ void PlayListWidget::addAllToList() { void PlayListWidget::addAllMusicToList() { QListIterator<DocLnk> dit( files.children() ); for ( ; dit.current(); ++dit ) { if(QFileInfo(dit.current()->file()).exists()) { d->selectedFiles->addToSelection( **dit ); } } } void PlayListWidget::addAllVideoToList() { QListIterator<DocLnk> dit( vFiles.children() ); for ( ; dit.current(); ++dit ) if(QFileInfo( dit.current()->file()).exists()) d->selectedFiles->addToSelection( **dit ); } void PlayListWidget::setDocument(const QString& fileref) { qDebug(fileref); fromSetDocument = TRUE; if ( fileref.isNull() ) { QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); return; } if(fileref.find("m3u",0,TRUE) != -1) { //is m3u readm3u( fileref); } else if(fileref.find("pls",0,TRUE) != -1) { //is pls readPls( fileref); } else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist clearList(); loadList(DocLnk(fileref)); d->selectedFiles->first(); } else { clearList(); addToSelection( DocLnk( fileref ) ); d->setDocumentUsed = TRUE; mediaPlayerState->setPlaying( FALSE ); qApp->processEvents(); mediaPlayerState->setPlaying( TRUE ); qApp->processEvents(); setCaption(tr("OpiePlayer")); } } void PlayListWidget::setActiveWindow() { + qDebug("SETTING active window"); // When we get raised we need to ensure that it switches views char origView = mediaPlayerState->view(); mediaPlayerState->setView( 'l' ); // invalidate mediaPlayerState->setView( origView ); // now switch back } void PlayListWidget::useSelectedDocument() { d->setDocumentUsed = FALSE; } const DocLnk *PlayListWidget::current() { // this is fugly switch (tabWidget->currentPageIndex()) { case 0: //playlist { qDebug("playlist"); if ( mediaPlayerState->playlist() ) { return d->selectedFiles->current(); } else if ( d->setDocumentUsed && d->current ) { return d->current; } else { return d->files->selected(); } } break; case 1://audio { qDebug("audioView"); QListIterator<DocLnk> dit( files.children() ); for ( ; dit.current(); ++dit ) { if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { qDebug("here"); insanityBool=TRUE; return dit; } } } break; case 2: // video { qDebug("videoView"); QListIterator<DocLnk> Vdit( vFiles.children() ); for ( ; Vdit.current(); ++Vdit ) { if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { insanityBool=TRUE; return Vdit; diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 878cd4a..19a9172 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp @@ -35,97 +35,96 @@ #include <qtimer.h> #include "xinecontrol.h" #include "mediaplayerstate.h" #include "videowidget.h" extern MediaPlayerState *mediaPlayerState; extern VideoWidget *videoUI; XineControl::XineControl( QObject *parent, const char *name ) : QObject( parent, name ) { libXine = new XINE::Lib(videoUI->vidWidget() ); connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( setPosition( long ) ) ); connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); } XineControl::~XineControl() { delete libXine; } void XineControl::play( const QString& fileName ) { libXine->play( fileName ); mediaPlayerState->setPlaying( true ); // default to audio view until we know how to handle video // MediaDetect mdetect; char whichGui = mdetect.videoOrAudio( fileName ); if (whichGui == 'f') { qDebug("Nicht erkannter Dateityp"); return; } if (whichGui == 'a') { libXine->setShowVideo( false ); } else { libXine->setShowVideo( true ); } // determine if slider is shown // mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) ); mediaPlayerState->setIsStreaming( libXine->isSeekable() ); // which gui (video / audio) mediaPlayerState->setView( whichGui ); length(); position(); - } void XineControl::stop( bool isSet ) { if ( !isSet) { libXine->stop(); mediaPlayerState->setList(); //mediaPlayerState->setPlaying( false ); } else { // play again } } void XineControl::pause( bool isSet) { libXine->pause(); } -int XineControl::currentTime() { +long XineControl::currentTime() { // todo: jede sekunde überprüfen m_currentTime = libXine->currentTime(); return m_currentTime; QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); } void XineControl::length() { m_length = libXine->length(); mediaPlayerState->setLength( m_length ); } long XineControl::position() { - qDebug("<<<<<<<<<<<< xinecontrol setPostion>>>>>>>>>"); - m_position = (m_currentTime/m_length*100); + m_position = ( currentTime() ); mediaPlayerState->setPosition( m_position ); long emitPos = (long)m_position; emit positionChanged( emitPos ); + if(mediaPlayerState->isPlaying) // needs to be stopped the media is stopped QTimer::singleShot( 1000, this, SLOT( position() ) ); - qDebug("POSITION : " + m_position); +// qDebug("POSITION : %d", m_position); return m_position; } void XineControl::setFullscreen( bool isSet ) { libXine->showVideoFullScreen( isSet); } void XineControl::seekTo( long second ) { // libXine-> } diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h index 07ad309..295d2b4 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.h +++ b/noncore/multimedia/opieplayer2/xinecontrol.h @@ -5,68 +5,67 @@ Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef XINECONTROL_H #define XINECONTROL_H #include "lib.h" #include "mediadetect.h" #include <qobject.h> class XineControl : public QObject { Q_OBJECT public: XineControl( QObject *parent = 0, const char *name =0 ); ~XineControl(); int m_length; public slots: void play( const QString& fileName ); void stop( bool ); void pause( bool ); void setFullscreen( bool ); - int currentTime(); + long currentTime(); void seekTo( long ); // get length of media file and set it void length(); - long position(); private: XINE::Lib *libXine; MediaDetect mdetect; - int m_currentTime; + long m_currentTime; long m_position; signals: void positionChanged( long ); }; #endif |