-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 8 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 2 |
4 files changed, 8 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 3b20873..d554141 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp @@ -126,96 +126,97 @@ Lib::Lib(XineVideoWidget* widget) { m_audioOutput, m_config ); // install the event handler xine_register_event_listener( m_xine, xine_event_handler, this ); } Lib::~Lib() { delete m_config; xine_remove_event_listener( m_xine, xine_event_handler ); xine_exit( m_xine ); delete m_videoOutput; //delete m_audioOutput; } void Lib::resize ( const QSize &s ) { if ( s. width ( ) && s. height ( )) { ::null_set_gui_width( m_videoOutput, s. width() ); ::null_set_gui_height(m_videoOutput, s. height() ); } } QCString Lib::version() { QCString str( xine_get_str_version() ); return str; }; int Lib::majorVersion() { return xine_get_major_version(); } int Lib::minorVersion() { return xine_get_minor_version(); }; int Lib::subVersion() { return xine_get_sub_version(); } int Lib::play( const QString& fileName, int startPos, int start_time ) { QString str = fileName.stripWhiteSpace(); //workaround OpiePlayer bug if (str.right(1) == QString::fromLatin1("/") ) str = str.mid( str.length() -1 ); return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(), startPos, start_time); } void Lib::stop() { + qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); xine_stop(m_xine ); } void Lib::pause(){ xine_set_speed( m_xine, SPEED_PAUSE ); } int Lib::speed() { return xine_get_speed( m_xine ); } void Lib::setSpeed( int speed ) { xine_set_speed( m_xine, speed ); } int Lib::status(){ return xine_get_status( m_xine ); } int Lib::currentPosition(){ return xine_get_current_position( m_xine ); } int Lib::currentTime() { return xine_get_current_time( m_xine ); }; int Lib::length() { return xine_get_stream_length( m_xine ); } bool Lib::isSeekable() { return xine_is_stream_seekable(m_xine); } Frame Lib::currentFrame() { Frame frame; return frame; }; int Lib::error() { return xine_get_error( m_xine ); }; void Lib::handleXineEvent( xine_event_t* t ) { if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) emit stopped(); } void Lib::setShowVideo( bool video ) { m_video = video; ::null_set_show_video( m_videoOutput, video ); } bool Lib::isShowingVideo() { return ::null_is_showing_video( m_videoOutput ); } void Lib::showVideoFullScreen( bool fullScreen ) { ::null_set_fullscreen( m_videoOutput, fullScreen ); } bool Lib::isVideoFullScreen() { diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 51fbb8b..93819f2 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -3,120 +3,120 @@ #include <qpe/resource.h> #include <qpe/config.h> #include <qmainwindow.h> #include <qmessagebox.h> #include <qwidgetstack.h> #include <qfile.h> #include "mediaplayer.h" #include "playlistwidget.h" #include "audiowidget.h" #include "videowidget.h" #include "volumecontrol.h" #include "mediaplayerstate.h" extern AudioWidget *audioUI; extern VideoWidget *videoUI; extern PlayListWidget *playList; extern MediaPlayerState *mediaPlayerState; MediaPlayer::MediaPlayer( QObject *parent, const char *name ) : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { xineControl = new XineControl(); // QPEApplication::grabKeyboard(); // EVIL connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 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() ) ); connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); - + volControl = new VolumeControl; } MediaPlayer::~MediaPlayer() { delete xineControl; delete volControl; } void MediaPlayer::pauseCheck( bool b ) { if ( b && !mediaPlayerState->playing() ) { mediaPlayerState->setPaused( FALSE ); } } void MediaPlayer::play() { mediaPlayerState->setPlaying( FALSE ); mediaPlayerState->setPlaying( TRUE ); } void MediaPlayer::setPlaying( bool play ) { if ( !play ) { - mediaPlayerState->setPaused( FALSE ); + //mediaPlayerState->setPaused( TRUE ); return; } if ( mediaPlayerState->paused() ) { mediaPlayerState->setPaused( FALSE ); return; } const DocLnk *playListCurrent = playList->current(); if ( playListCurrent != NULL ) { currentFile = playListCurrent; } xineControl->play( currentFile->file() ); xineControl->length(); long seconds = mediaPlayerState->length();// QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); qDebug(time); QString tickerText; if( currentFile->file().left(4) == "http" ) tickerText= tr( " File: " ) + currentFile->name(); else tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; // QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); // if ( !fileInfo.isEmpty() ) // tickerText += ", " + fileInfo; // audioUI->setTickerText( tickerText + "." ); audioUI->setTickerText( currentFile->file( ) ); } void MediaPlayer::prev() { if ( playList->prev() ) { play(); } else if ( mediaPlayerState->looping() ) { if ( playList->last() ) { play(); } } else { mediaPlayerState->setList(); } } diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index c210ffb..77e2095 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -640,97 +640,97 @@ void PlayListWidget::addSelected() { QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); switch (tabWidget->currentPageIndex()) { case 0: //playlist break; case 1: { //audio QListViewItemIterator it( audioView ); // iterate through all items of the listview for ( ; it.current(); ++it ) { if ( it.current()->isSelected() ) { QListIterator<DocLnk> dit( files.children() ); for ( ; dit.current(); ++dit ) { if( dit.current()->name() == it.current()->text(0) ) { d->selectedFiles->addToSelection( **dit ); } } audioView->setSelected( it.current(),FALSE); } } tabWidget->setCurrentPage(0); } break; case 2: { // video QListViewItemIterator it( videoView ); // iterate through all items of the listview for ( ; it.current(); ++it ) { if ( it.current()->isSelected() ) { QListIterator<DocLnk> dit( vFiles.children() ); for ( ; dit.current(); ++dit ) { if( dit.current()->name() == it.current()->text(0) ) { d->selectedFiles->addToSelection( **dit ); } } videoView->setSelected( it.current(),FALSE); } } tabWidget->setCurrentPage(0); } break; }; } void PlayListWidget::removeSelected() { d->selectedFiles->removeSelected( ); } void PlayListWidget::playIt( QListViewItem *it) { - if(it==NULL) return; + // if(it==NULL) return; qDebug("playIt"); mediaPlayerState->setPlaying(FALSE); mediaPlayerState->setPlaying(TRUE); d->selectedFiles->unSelect(); } void PlayListWidget::addToSelection( QListViewItem *it) { d->setDocumentUsed = FALSE; if(it) { switch (tabWidget->currentPageIndex()) { case 1: { QListIterator<DocLnk> dit( files.children() ); for ( ; dit.current(); ++dit ) { if( dit.current()->name() == it->text(0)) { d->selectedFiles->addToSelection( **dit ); } } } break; case 2: { QListIterator<DocLnk> dit( vFiles.children() ); for ( ; dit.current(); ++dit ) { if( dit.current()->name() == it->text(0)) { d->selectedFiles->addToSelection( **dit ); } } } break; case 0: break; }; tabWidget->setCurrentPage(0); } } void PlayListWidget::tabChanged(QWidget *) { switch ( tabWidget->currentPageIndex()) { case 0: { if( !tbDeletePlaylist->isHidden()) tbDeletePlaylist->hide(); d->tbRemoveFromList->setEnabled(TRUE); d->tbAddToList->setEnabled(FALSE); } break; case 1: @@ -1188,98 +1188,98 @@ void PlayListWidget::readPls(const QString &filename) { if(f.open(IO_ReadOnly)) { QTextStream t(&f); QString s;//, first, second; int i=0; while ( !t.atEnd()) { s=t.readLine(); if(s.left(4) == "File") { s=s.right(s.length() - 6); s.replace(QRegExp("%20")," "); qDebug("adding "+s+" to playlist"); // numberofentries=2 // File1=http // Title // Length // Version // File2=http s=s.replace( QRegExp("\\"),"/"); DocLnk lnk( s ); QFileInfo f(s); QString name = f.baseName(); if(name.left(4)=="http") name = s.right( s.length() - 7); else name=s; name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); lnk.setName( name); if(s.at(s.length()-4) == '.') // if this is probably a file lnk.setFile( s); else { //if its a url if( name.right(1).find('/') == -1) s+="/"; lnk.setFile( s); } lnk.setType("audio/x-mpegurl"); qDebug("DocLnk add "+name); d->selectedFiles->addToSelection( lnk); } } i++; } } void PlayListWidget::pmViewActivated(int index) { qDebug("%d", index); switch(index) { case -16: { - + mediaPlayerState->toggleFullscreen(); bool b=mediaPlayerState->fullscreen(); pmView->setItemChecked( index,b); Config cfg( "OpiePlayer" ); cfg.writeEntry("FullScreen", b); - + } break; }; } void PlayListWidget::populateSkinsMenu() { int item=0; defaultSkinIndex=0; QString skinName; Config cfg( "OpiePlayer" ); cfg.setGroup("Options"); QString skin = cfg.readEntry("Skin","default"); QDir skinsDir(QPEApplication::qpeDir()+"/pics/opieplayer2/skins"); skinsDir.setFilter( QDir::Dirs); skinsDir.setSorting(QDir::Name); const QFileInfoList *skinslist = skinsDir.entryInfoList(); QFileInfoListIterator it( *skinslist ); QFileInfo *fi; while ( (fi=it.current()) ) { skinName = fi->fileName(); qDebug( fi->fileName()); if( skinName != "." && skinName != ".." && skinName !="CVS") item = skinsMenu->insertItem( fi->fileName()); if( skinName == "default") defaultSkinIndex = item; if( skinName == skin) skinsMenu->setItemChecked( item, TRUE); - + ++it; } } void PlayListWidget::skinsMenuActivated(int item) { for(int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i--) { skinsMenu->setItemChecked( i, FALSE); } skinsMenu->setItemChecked( item, TRUE); Config cfg( "OpiePlayer" ); cfg.setGroup("Options"); cfg.writeEntry("Skin", skinsMenu->text( item)); } diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 17112a2..8fd2743 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp @@ -71,97 +71,97 @@ void XineControl::play( const QString& fileName ) { hasVideoChannel=FALSE; hasAudioChannel=FALSE; m_fileName = 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 ); hasAudioChannel=TRUE; } else { libXine->setShowVideo( true ); hasVideoChannel=TRUE; } // determine if slider is shown // mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) ); mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); // which gui (video / audio) mediaPlayerState->setView( whichGui ); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) if ( !disabledSuspendScreenSaver ) { disabledSuspendScreenSaver = TRUE; // Stop the screen from blanking and power saving state QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); } #endif length(); position(); } void XineControl::nextMedia() { mediaPlayerState->setNext(); } void XineControl::stop( bool isSet ) { if ( !isSet) { libXine->stop( ); mediaPlayerState->setList(); - //mediaPlayerState->setPlaying( false ); + // mediaPlayerState->setPlaying( false ); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) if ( disabledSuspendScreenSaver ) { disabledSuspendScreenSaver = FALSE; // Re-enable the suspend mode QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; } #endif } else { // play again } } /** * Pause playback * @isSet */ void XineControl::pause( bool isSet) { if (isSet) { libXine->pause(); } else { libXine->play( m_fileName, 0, m_currentTime); } } /** * get current time in playback */ long XineControl::currentTime() { // todo: jede sekunde überprüfen m_currentTime = libXine->currentTime(); return m_currentTime; QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); } /** * Set the length of the media file */ void XineControl::length() { m_length = libXine->length(); mediaPlayerState->setLength( m_length ); } /** * Reports the position the xine backend is at right now |