summaryrefslogtreecommitdiff
authorbipolar <bipolar>2002-03-03 20:00:13 (UTC)
committer bipolar <bipolar>2002-03-03 20:00:13 (UTC)
commit1c2cb5505bd88b1f38cf65936486a73081da8cf4 (patch) (side-by-side diff)
tree876541302b9d1c5e0be619cc44338f2538d68c58
parent86ade8478229710d4a31d1c0604b79565935734e (diff)
downloadopie-1c2cb5505bd88b1f38cf65936486a73081da8cf4.zip
opie-1c2cb5505bd88b1f38cf65936486a73081da8cf4.tar.gz
opie-1c2cb5505bd88b1f38cf65936486a73081da8cf4.tar.bz2
committed by ljp (llornkcor): small fix for player redraw not going so well
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index ae03ec8..de36551 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -476,286 +476,288 @@ bool PlayListWidget::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();
}
}
bool PlayListWidget::first() {
if ( mediaPlayerState->playlist() )
return d->selectedFiles->first();
else
return mediaPlayerState->looping();
}
bool PlayListWidget::last() {
if ( mediaPlayerState->playlist() )
return d->selectedFiles->last();
else
return mediaPlayerState->looping();
}
void PlayListWidget::saveList() {
QString filename;
InputDialog *fileDlg;
fileDlg=new InputDialog(this,"Save Playlist",TRUE, 0);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
filename = fileDlg->LineEdit1->text();//+".playlist";
qDebug("saving playlist "+filename+".playlist");
// DocLnk *lnk;
// lnk.setName( filename); //sets file name
// // lnk.setComment(title);
// lnk.setFile( filename+".playlist"); //sets File property
// lnk.setType("player/plain");// hey is this a REGISTERED mime type?!?!? ;D
// lnk.setIcon("MPEGPlayer");
// if(!lnk.writeLink())
// qDebug("Writing doclink did not work");
Config cfg( filename +".playlist");
writeConfig( cfg );
}
DocLnk lnk;
lnk.setName( filename); //sets file name
// lnk.setComment(title);
lnk.setFile(QPEApplication::qpeDir()+"Settings/"+filename+".playlist.conf"); //sets File property
lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D
lnk.setIcon("MPEGPlayer");
if(!lnk.writeLink())
qDebug("Writing doclink did not work");
if(fileDlg)
delete fileDlg;
}
void PlayListWidget::loadList( const DocLnk & lnk) {
qDebug("load list "+ lnk.name()+".playlist");
clearList();
Config cfg( lnk.name()+".playlist");
readConfig(cfg);
tabWidget->setCurrentPage(0);
setCaption("OpiePlayer: "+lnk.name());
}
void PlayListWidget::setPlaylist( bool shown ) {
if ( shown )
d->playListFrame->show();
else
d->playListFrame->hide();
}
void PlayListWidget::setView( char view ) {
if ( view == 'l' )
showMaximized();
else
hide();
}
void PlayListWidget::addSelected() {
switch (tabWidget->currentPageIndex()) {
case 0: //playlist
break;
case 1: { //audio
addToSelection( audioView->selectedItem() );
}
break;
case 2: { // video
addToSelection( videoView->selectedItem() );
}
break;
};
}
void PlayListWidget::removeSelected() {
d->selectedFiles->removeSelected( );
}
void PlayListWidget::playIt( QListViewItem *it) {
// d->setDocumentUsed = FALSE;
mediaPlayerState->setPlaying(TRUE);
}
void PlayListWidget::addToSelection( QListViewItem *it) {
d->setDocumentUsed = FALSE;
if(it) {
// qDebug("add to selection");
switch (tabWidget->currentPageIndex()) {
case 1: {
// qDebug("case 1");
QListIterator<DocLnk> dit( files.children() );
for ( ; dit.current(); ++dit ) {
// qDebug(dit.current()->name());
if( dit.current()->name() == it->text(0)) {
d->selectedFiles->addToSelection( **dit );
}
}
}
break;
case 2: {
// qDebug("case 2");
QListIterator<DocLnk> dit( vFiles.children() );
for ( ; dit.current(); ++dit ) {
// qDebug(dit.current()->name());
if( dit.current()->name() == it->text(0)) {
d->selectedFiles->addToSelection( **dit );
}
}
}
break;
case 0:
break;
};
tabWidget->setCurrentPage(0);
// mediaPlayerState->setPlaying( TRUE );
}
}
void PlayListWidget::tabChanged(QWidget *widg) {
switch ( tabWidget->currentPageIndex()) {
case 0:
{
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;
};
}
/*
list is right clicked*/
void PlayListWidget::fauxPlay(QListViewItem *it) {
switch (tabWidget->currentPageIndex()) {
case 0: //playlist
break;
case 1: { //audio
QListIterator<DocLnk> dit( files.children() );
for ( ; dit.current(); ++dit ) {
// qDebug(dit.current()->name());
if( dit.current()->name() == it->text(0)) {
d->selectedFiles->addToSelection( **dit );
}
}
}
break;
case 2: { // video
QListIterator<DocLnk> dit( vFiles.children() );
for ( ; dit.current(); ++dit ) {
// qDebug(dit.current()->name());
if( dit.current()->name() == it->text(0)) {
d->selectedFiles->addToSelection( **dit );
}
}
}
break;
};
mediaPlayerState->setPlaying( TRUE );
// tabWidget->setCurrentPage(0);
d->selectedFiles->removeSelected();
}
/*
play button is pressed*/
void PlayListWidget::btnPlay(bool b) { // this is fugly
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);
}
break;
case 2:
{
addToSelection( videoView->selectedItem() );
mediaPlayerState->setPlaying(b);
+ qApp->processEvents();
d->selectedFiles->removeSelected( );
tabWidget->setCurrentPage(2);
}
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;
};
}