summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-10 21:06:18 (UTC)
committer llornkcor <llornkcor>2002-04-10 21:06:18 (UTC)
commit0c06c5acf099223f8b0b63849e7e4ed52bf365bb (patch) (side-by-side diff)
tree9296f9c4ad38b84ecfdbfe8056b19a6ba2765dd0
parent5d7caf051fb1b46fc2ed7d2f71b03fdf3b42b3ac (diff)
downloadopie-0c06c5acf099223f8b0b63849e7e4ed52bf365bb.zip
opie-0c06c5acf099223f8b0b63849e7e4ed52bf365bb.tar.gz
opie-0c06c5acf099223f8b0b63849e7e4ed52bf365bb.tar.bz2
kickin out the bug fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp100
1 files changed, 49 insertions, 51 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 0764c01..809d5ac 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -426,140 +426,141 @@ void PlayListWidget::setDocument(const QString& fileref) {
return;
}
// qDebug("setDocument "+fileref);
if(fileref.find("playlist",0,TRUE) == -1) {
clearList();
addToSelection( DocLnk( fileref ) );
d->setDocumentUsed = TRUE;
mediaPlayerState->setPlaying( FALSE );
qApp->processEvents();
mediaPlayerState->setPlaying( TRUE );
qApp->processEvents();
setCaption(tr("OpiePlayer"));
} else { //is playlist
clearList();
loadList(DocLnk(fileref));
d->selectedFiles->first();
}
}
void PlayListWidget::setActiveWindow() {
// 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
// if( fromSetDocument) {
// qDebug("from setDoc");
// DocLnkSet files;
// Global::findDocuments(&files, "video/*;audio/*");
// QListIterator<DocLnk> dit( files.children() );
// for ( ; dit.current(); ++dit ) {
// if(dit.current()->linkFile() == setDocFileRef) {
// qDebug(setDocFileRef);
// return dit;
// }
// }
// } else
-// qDebug("current");
-// 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");
-// Global::findDocuments(&files, "audio/*");
-// 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");
-// Global::findDocuments(&vFiles, "video/*");
-// QListIterator<DocLnk> Vdit( vFiles.children() );
-// for ( ; Vdit.current(); ++Vdit ) {
-// if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) {
-// insanityBool=TRUE;
-// return Vdit;
-// }
-// }
-// }
-// break;
-// };
-// return 0;
+
+
+ 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");
+// Global::findDocuments(&files, "audio/*");
+ 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");
+// Global::findDocuments(&vFiles, "video/*");
+ QListIterator<DocLnk> Vdit( vFiles.children() );
+ for ( ; Vdit.current(); ++Vdit ) {
+ if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) {
+ insanityBool=TRUE;
+ return Vdit;
+ }
+ }
+ }
+ break;
+ };
+ return 0;
}
bool PlayListWidget::prev() {
if ( mediaPlayerState->playlist() ) {
if ( mediaPlayerState->shuffled() ) {
const DocLnk *cur = current();
int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
for ( int i = 0; i < j; i++ ) {
if ( !d->selectedFiles->next() )
d->selectedFiles->first();
}
if ( cur == current() )
if ( !d->selectedFiles->next() )
d->selectedFiles->first();
return TRUE;
} else {
if ( !d->selectedFiles->prev() ) {
if ( mediaPlayerState->looping() ) {
return d->selectedFiles->last();
} else {
return FALSE;
}
}
return TRUE;
}
} else {
return mediaPlayerState->looping();
}
}
bool PlayListWidget::next() {
if ( mediaPlayerState->playlist() ) {
if ( mediaPlayerState->shuffled() ) {
return prev();
} else {
if ( !d->selectedFiles->next() ) {
if ( mediaPlayerState->looping() ) {
return d->selectedFiles->first();
} else {
return FALSE;
}
}
return TRUE;
}
} else {
return mediaPlayerState->looping();
}
@@ -749,114 +750,111 @@ void PlayListWidget::tabChanged(QWidget *widg) {
{
if( !tbDeletePlaylist->isHidden())
tbDeletePlaylist->hide();
d->tbRemoveFromList->setEnabled(TRUE);
d->tbAddToList->setEnabled(FALSE);
}
break;
case 1:
{
if( !tbDeletePlaylist->isHidden())
tbDeletePlaylist->hide();
d->tbRemoveFromList->setEnabled(FALSE);
d->tbAddToList->setEnabled(TRUE);
}
break;
case 2:
{
if( !tbDeletePlaylist->isHidden())
tbDeletePlaylist->hide();
d->tbRemoveFromList->setEnabled(FALSE);
d->tbAddToList->setEnabled(TRUE);
}
break;
case 3:
{
if( tbDeletePlaylist->isHidden())
tbDeletePlaylist->show();
playLists->reread();
}
break;
};
}
void PlayListWidget::btnPlay(bool b) {
// mediaPlayerState->setPlaying(b);
switch ( tabWidget->currentPageIndex()) {
case 0:
{
mediaPlayerState->setPlaying(b);
}
break;
case 1:
{
addToSelection( audioView->selectedItem() );
mediaPlayerState->setPlaying(b);
-// qApp->processEvents();
d->selectedFiles->removeSelected( );
tabWidget->setCurrentPage(1);
- audioView->clearSelection();
-// d->selectedFiles->unSelect();
-// mediaPlayerState->setPlaying(FALSE);
+ d->selectedFiles->unSelect();
+// audioView->clearSelection();
}
break;
case 2:
{
addToSelection( videoView->selectedItem() );
mediaPlayerState->setPlaying(b);
qApp->processEvents();
d->selectedFiles->removeSelected( );
tabWidget->setCurrentPage(2);
- videoView->clearSelection();
-// d->selectedFiles->unSelect();
-// mediaPlayerState->setPlaying(FALSE);
+ d->selectedFiles->unSelect();
+// videoView->clearSelection();
}
break;
};
}
void PlayListWidget::deletePlaylist() {
switch( QMessageBox::information( this, (tr("Remove Playlist?")),
(tr("You really want to delete\nthis playlist?")),
(tr("Yes")), (tr("No")), 0 )){
case 0: // Yes clicked,
QFile().remove(playLists->selected()->file());
QFile().remove(playLists->selected()->linkFile());
playLists->reread();
break;
case 1: // Cancel
break;
};
}
void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
{
switch (mouse) {
case 1:
break;
case 2:{
QPopupMenu m;
m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
m.insertSeparator();
m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
m.exec( QCursor::pos() );
}
break;
};
}
void PlayListWidget::playSelected()
{
btnPlay( TRUE);
}
void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
{
switch (mouse) {
case 1:
break;
case 2:{