-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 @@ -242,25 +242,25 @@ void AudioWidget::sliderPressed() { } 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(); @@ -281,34 +281,34 @@ void AudioWidget::setView( char view ) { 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 ); } 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 @@ -100,24 +100,25 @@ long MediaPlayerState::position() { } 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; 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 @@ -39,24 +39,27 @@ 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(); @@ -105,27 +108,24 @@ signals: 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 @@ -163,25 +163,25 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 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); @@ -417,24 +417,25 @@ void PlayListWidget::setDocument(const QString& fileref) { 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; } 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 @@ -71,61 +71,60 @@ void XineControl::play( const QString& fileName ) { 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 @@ -41,32 +41,31 @@ 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 |