summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp39
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h1
2 files changed, 26 insertions, 14 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index c6de5e6..5d0f6de 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -362,18 +362,19 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
loadList(DocLnk( currentPlaylist));
setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlaylist)));
initializeStates();
+ // audioUI->setFocus();
}
PlayListWidget::~PlayListWidget() {
Config cfg( "OpiePlayer" );
writeConfig( cfg );
- if ( d->current )
- delete d->current;
- delete d;
+ if ( d->current )
+ delete d->current;
+ if(d) delete d;
}
void PlayListWidget::initializeStates() {
@@ -493,17 +494,24 @@ void PlayListWidget::addAllVideoToList() {
}
void PlayListWidget::setDocument(const QString& fileref) {
- qDebug(fileref);
- fromSetDocument = TRUE;
+ fromSetDocument = true;
+ d->setDocumentUsed = TRUE;
+ mediaPlayerState->setPlaying( FALSE );
+ qApp->processEvents();
+ mediaPlayerState->setPlaying( TRUE );
+}
+
+void PlayListWidget::setDocumentEx(const QString& fileref) {
+
QFileInfo fileInfo(fileref);
if ( !fileInfo.exists() ) {
QMessageBox::critical( 0, tr( "Invalid File" ),
tr( "There was a problem in getting the file." ) );
return;
}
-// qDebug("setDocument "+fileref);
+ qDebug("setDocument "+fileref);
QString extension = fileInfo.extension(false);
if( extension.find( "m3u", 0, false) != -1) { //is m3u
readm3u( fileref);
}
@@ -529,9 +537,9 @@ void PlayListWidget::setDocument(const QString& fileref) {
d->setDocumentUsed = TRUE;
mediaPlayerState->setPlaying( FALSE );
qApp->processEvents();
mediaPlayerState->setPlaying( TRUE );
- qApp->processEvents();
+ // qApp->processEvents();
setCaption(tr("OpiePlayer"));
}
}
@@ -758,9 +766,9 @@ void PlayListWidget::removeSelected() {
void PlayListWidget::playIt( QListViewItem *) {
// d->setDocumentUsed = FALSE;
// mediaPlayerState->curPosition =0;
qDebug("playIt");
- mediaPlayerState->setPlaying(FALSE);
+ // mediaPlayerState->setPlaying(FALSE);
mediaPlayerState->setPlaying(TRUE);
d->selectedFiles->unSelect();
}
@@ -781,9 +789,10 @@ void PlayListWidget::addToSelection( QListViewItem *it) {
lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
- writeCurrentM3u();
+ if(tabWidget->currentPageIndex() == 0)
+ writeCurrentM3u();
// tabWidget->setCurrentPage(0);
}
}
@@ -830,9 +839,9 @@ void PlayListWidget::tabChanged(QWidget *) {
};
}
void PlayListWidget::btnPlay(bool b) {
- qDebug("<<<<<<<<<<<<<<<BtnPlay");
+ qDebug("<<<<<<<<<<<<<<<BtnPlay %d", b);
// mediaPlayerState->setPlaying(b);
switch ( tabWidget->currentPageIndex()) {
case 0:
{
@@ -851,9 +860,9 @@ void PlayListWidget::btnPlay(bool b) {
{
qDebug("2");
// d->selectedFiles->unSelect();
addToSelection( audioView->currentItem() );
- mediaPlayerState->setPlaying(true);
+ mediaPlayerState->setPlaying( b);
d->selectedFiles->removeSelected( );
d->selectedFiles->unSelect();
tabWidget->setCurrentPage(1);
insanityBool=FALSE;
@@ -863,9 +872,9 @@ void PlayListWidget::btnPlay(bool b) {
{
qDebug("3");
addToSelection( videoView->currentItem() );
- mediaPlayerState->setPlaying(true);
+ mediaPlayerState->setPlaying( b);
// qApp->processEvents();
d->selectedFiles->removeSelected( );
d->selectedFiles->unSelect();
tabWidget->setCurrentPage(2);
@@ -1458,9 +1467,9 @@ void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
} else if ( msg == "stop()" ) {
mediaPlayerState->setPlaying( false);
} else if ( msg == "togglePause()" ) {
mediaPlayerState->togglePaused();
- } else if ( msg == "next()" ) { //select next in list
+ } else if ( msg == "next()" ) { //select next in lis
mediaPlayerState->setNext();
} else if ( msg == "prev()" ) { //select previous in list
mediaPlayerState->setPrev();
} else if ( msg == "toggleLooping()" ) { //loop or not loop
@@ -1475,9 +1484,9 @@ void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
// emit lessReleased();
} else if ( msg == "play(QString)" ) { //play this now
QString file;
stream >> file;
- setDocument( (const QString &) file);
+ setDocumentEx( (const QString &) file);
} else if ( msg == "add(QString)" ) { //add to playlist
QString file;
stream >> file;
QFileInfo fileInfo(file);
@@ -1488,7 +1497,9 @@ void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
} else if ( msg == "rem(QString)" ) { //remove from playlist
QString file;
stream >> file;
+ } else if ( msg == "setDocument(QString)" ) { //loop or not loop
+ QCopEnvelope h("QPE/Application/opieplayer", "raise()");
}
}
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h
index e66bcb9..0c0e367 100644
--- a/core/multimedia/opieplayer/playlistwidget.h
+++ b/core/multimedia/opieplayer/playlistwidget.h
@@ -101,8 +101,9 @@ private slots:
void scanForAudio();
void scanForVideo();
void openFile();
void setDocument( const QString& fileref );
+ void setDocumentEx( const QString& fileref );
void addToSelection( const DocLnk& ); // Add a media file to the playlist
void addToSelection( QListViewItem* ); // Add a media file to the playlist
void setActiveWindow(); // need to handle this to show the right view
void setPlaylist( bool ); // Show/Hide the playlist