From 3f2a74813b552c6f7a4450ec6294bbbcc5b811c5 Mon Sep 17 00:00:00 2001 From: llornkcor Date: Wed, 04 Sep 2002 23:38:09 +0000 Subject: change playing in file lists. no loop mode --- (limited to 'noncore/multimedia/opieplayer2') diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 040e965..446fa45 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -453,6 +453,7 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { if ( !audioButtons[i].isToggle ) { setToggleButton( i, FALSE ); } + qDebug("mouseEvent %d", i); switch (i) { case AudioPlay: if( mediaPlayerState->isPaused ) { diff --git a/noncore/multimedia/opieplayer2/inputDialog.cpp b/noncore/multimedia/opieplayer2/inputDialog.cpp index 9edb1d3..62240b2 100644 --- a/noncore/multimedia/opieplayer2/inputDialog.cpp +++ b/noncore/multimedia/opieplayer2/inputDialog.cpp @@ -25,6 +25,7 @@ InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags connect( browserButton, SIGNAL(released()),this,SLOT(browse())); LineEdit1 = new QLineEdit( this, "LineEdit1" ); LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); + LineEdit1->setFocus(); } /* * return the current text(input) diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index bf2acc8..553e3c1 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -75,8 +76,8 @@ void MediaPlayer::pauseCheck( bool b ) { } void MediaPlayer::play() { - mediaPlayerState->setPlaying( FALSE ); - mediaPlayerState->setPlaying( TRUE ); + mediaPlayerState->setPlaying( FALSE ); + mediaPlayerState->setPlaying( TRUE ); } void MediaPlayer::setPlaying( bool play ) { @@ -84,56 +85,85 @@ void MediaPlayer::setPlaying( bool play ) { return; } - if ( mediaPlayerState->paused() ) { - mediaPlayerState->setPaused( FALSE ); - return; - } - - const DocLnk *playListCurrent = playList->current(); - if ( playListCurrent != NULL ) { - currentFile = playListCurrent; + if ( mediaPlayerState->paused() ) { + mediaPlayerState->setPaused( FALSE ); + return; } - xineControl->play( currentFile->file() ); - - 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; - - audioUI->setTickerText( currentFile->file( ) ); + QString tickerText, time, fileName; + if( playList->whichList() == 0 ) { //check for filelist + const DocLnk *playListCurrent = playList->current(); + if ( playListCurrent != NULL ) { + currentFile = playListCurrent; + } + xineControl->play( currentFile->file() ); + fileName = currentFile->name(); + long seconds = mediaPlayerState->length();// + time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); + qDebug(time); + + } else { //if playing in file list.. play in a different way + // random and looping settings enabled causes problems here, + // since there is no selected file in the playlist, but a selected file in the file list, + // so we remember and shutoff + l = mediaPlayerState->looping(); + if(l) + mediaPlayerState->setLooping( false ); + r = mediaPlayerState->shuffled(); + mediaPlayerState->setShuffled(false); + + fileName = playList->currentFileListPathName(); + xineControl->play( fileName); + long seconds = mediaPlayerState->length();// + time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); + qDebug(time); + if( fileName.left(4) != "http" ) + fileName = QFileInfo( fileName).baseName(); + } + if( fileName.left(4) == "http" ) + tickerText= tr( " File: " ) + fileName; + else + tickerText = tr( " File: " ) + fileName + tr(", Length: ") + time; + audioUI->setTickerText( tickerText ); } void MediaPlayer::prev() { - if ( playList->prev() ) { - play(); - } else if ( mediaPlayerState->looping() ) { - if ( playList->last() ) { + if(playList->whichList() == 0) { //if using the playlist + if ( playList->prev() ) { play(); + } else if ( mediaPlayerState->looping() ) { + if ( playList->last() ) { + play(); + } + } else { + mediaPlayerState->setList(); } - } else { - mediaPlayerState->setList(); } } void MediaPlayer::next() { - if ( playList->next() ) { - play(); - } else if ( mediaPlayerState->looping() ) { - if ( playList->first() ) { + + if(playList->whichList() == 0) { //if using the playlist + if ( playList->next() ) { play(); + } else if ( mediaPlayerState->looping() ) { + if ( playList->first() ) { + play(); + } + } else { + mediaPlayerState->setList(); } - } else { - mediaPlayerState->setList(); + } else { //if playing from file list, let's just stop + qDebug("<<<<<<<<<<<<<<<<setPlaying(false); + mediaPlayerState->setView('l'); + if(l) mediaPlayerState->setLooping(l); + if(r) mediaPlayerState->setShuffled(r); } + qApp->processEvents(); } diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h index 81fab88..05be128 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.h +++ b/noncore/multimedia/opieplayer2/mediaplayer.h @@ -17,7 +17,6 @@ class MediaPlayer : public QObject { public: MediaPlayer( QObject *parent, const char *name ); ~MediaPlayer(); - private slots: void setPlaying( bool ); void pauseCheck( bool ); @@ -34,7 +33,7 @@ protected: void timerEvent( QTimerEvent *e ); void keyReleaseEvent( QKeyEvent *e); private: - bool isBlanked; + bool isBlanked, l, r; int fd; int volumeDirection; const DocLnk *currentFile; diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 3bd04bc..15c70c3 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -321,7 +321,7 @@ void PlayListWidget::useSelectedDocument() { const DocLnk *PlayListWidget::current() { // this is fugly - switch ( tabWidget->currentPageIndex() ) { + switch ( whichList() ) { case 0: //playlist { // qDebug("playlist"); @@ -394,7 +394,8 @@ bool PlayListWidget::prev() { bool PlayListWidget::next() { - if ( mediaPlayerState->playlist() ) { +qDebug("<<<<<<<<<<<playlist() ) { if ( mediaPlayerState->shuffled() ) { return prev(); } else { @@ -497,7 +498,7 @@ void PlayListWidget::addSelected() { QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); - switch (tabWidget->currentPageIndex()) { + switch (whichList()) { case 0: //playlist break; case 1: { //audio @@ -557,7 +558,7 @@ void PlayListWidget::addToSelection( QListViewItem *it) { d->setDocumentUsed = FALSE; if(it) { - switch (tabWidget->currentPageIndex()) { + switch ( whichList()) { case 1: { QListIterator dit( files.children() ); for ( ; dit.current(); ++dit ) { @@ -588,7 +589,7 @@ void PlayListWidget::addToSelection( QListViewItem *it) { void PlayListWidget::tabChanged(QWidget *) { - switch ( tabWidget->currentPageIndex()) { + switch ( whichList()) { case 0: { if( !tbDeletePlaylist->isHidden() ) { @@ -634,35 +635,34 @@ void PlayListWidget::tabChanged(QWidget *) { void PlayListWidget::btnPlay(bool b) { - // mediaPlayerState->setPlaying(b); - switch ( tabWidget->currentPageIndex()) { - case 0: - { - mediaPlayerState->setPlaying(b); - } - break; - case 1: - { - addToSelection( audioView->currentItem() ); - mediaPlayerState->setPlaying(b); - d->selectedFiles->removeSelected( ); - tabWidget->setCurrentPage(1); - d->selectedFiles->unSelect(); - insanityBool=FALSE; - }// audioView->clearSelection(); - break; - case 2: - { - addToSelection( videoView->currentItem() ); - mediaPlayerState->setPlaying(b); - qApp->processEvents(); - d->selectedFiles->removeSelected( ); - tabWidget->setCurrentPage(2); - d->selectedFiles->unSelect(); - insanityBool=FALSE; - }// videoView->clearSelection(); - break; - }; + mediaPlayerState->setPlaying(b); + qApp->processEvents(); + insanityBool=FALSE; +// switch ( whichList()) { +// case 0: +// { +// mediaPlayerState->setPlaying(b); +// } +// break; +// case 1: +// { +// mediaPlayerState->setPlaying(b); +// qApp->processEvents(); +// insanityBool=FALSE; +// }// audioView->clearSelection(); +// break; +// case 2: +// { +// // addToSelection( videoView->currentItem() ); +// mediaPlayerState->setPlaying(b); +// qApp->processEvents(); +// // d->selectedFiles->removeSelected( ); +// // tabWidget->setCurrentPage(2); +// // d->selectedFiles->unSelect(); +// insanityBool=FALSE; +// }// videoView->clearSelection(); +// break; +// }; } @@ -736,7 +736,8 @@ void PlayListWidget::populateAudioView() { size=0; else size = QFile( dit.current()->file() ).size(); - newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number(size ), storage); + newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), + QString::number(size ), storage, dit.current()->file()); newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); } } @@ -755,20 +756,21 @@ void PlayListWidget::populateVideoView() { QListIterator Vdit( vFiles.children() ); QListIterator it ( fs ); videoView->clear(); - QString storage; + QString storage, pathName; for ( ; Vdit.current(); ++Vdit ) { for( ; it.current(); ++it ) { const QString name = (*it)->name(); const QString path = (*it)->path(); if( Vdit.current()->file().find(path) != -1 ) { storage=name; + pathName=path; } } QListViewItem * newItem; if ( QFile( Vdit.current()->file() ).exists() ) { newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), - QString::number( QFile( Vdit.current()->file() ).size() ), storage ); + QString::number( QFile( Vdit.current()->file() ).size() ), storage, Vdit.current()->file()); newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); } } @@ -1062,3 +1064,19 @@ void PlayListWidget::skinsMenuActivated( int item ) { cfg.setGroup("Options"); cfg.writeEntry("Skin", skinsMenu->text( item ) ); } + +int PlayListWidget::whichList() { + return tabWidget->currentPageIndex(); +} + +QString PlayListWidget::currentFileListPathName() { + switch (whichList()) { + case 1: + return audioView->currentItem()->text(3); + break; + case 2: + return videoView->currentItem()->text(3); + break; + }; + return ""; +} diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index dcfdd48..2873dca 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h @@ -66,6 +66,7 @@ public: const DocLnk *current(); void useSelectedDocument(); int selected; + int whichList(); public slots: bool first(); @@ -73,7 +74,7 @@ public slots: bool next(); bool prev(); void writeConfig( Config& cfg ) const; - + QString currentFileListPathName(); protected: void keyReleaseEvent( QKeyEvent *e); diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp index 250833c..f073102 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp @@ -155,6 +155,7 @@ PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags audioView->addColumn( tr( "Title" ), 140 ); audioView->addColumn( tr( "Size" ), -1 ); audioView->addColumn( tr( "Media" ), -1 ); + audioView->addColumn( tr( "Path" ), 0 ); audioView->setColumnAlignment( 1, Qt::AlignRight ); audioView->setColumnAlignment( 2, Qt::AlignRight ); audioView->setAllColumnsShowFocus( TRUE ); @@ -176,6 +177,7 @@ PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags videoView->addColumn( tr( "Title" ), 140); videoView->addColumn( tr( "Size" ), -1 ); videoView->addColumn(tr( "Media" ), -1 ); + videoView->addColumn(tr( "Path" ), 0 ); videoView->setColumnAlignment( 1, Qt::AlignRight ); videoView->setColumnAlignment( 2, Qt::AlignRight ); videoView->setAllColumnsShowFocus( TRUE ); -- cgit v0.9.0.2