-rw-r--r-- | core/multimedia/opieplayer/libmad/libmadplugin.cpp | 14 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 78 |
2 files changed, 55 insertions, 37 deletions
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp index 6793773..7de4282 100644 --- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp +++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp @@ -533,14 +533,14 @@ int LibMadPlugin::audioFrequency( int ) { int LibMadPlugin::audioSamples( int ) { debugMsg( "LibMadPlugin::audioSamples" ); -/* - long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); - mad_header_decode( (struct mad_header *)&d->frame.header, &d->stream ); - qDebug( "LibMadPlugin::audioSamples: %i*%i", d->frame.header.duration.seconds, d->frame.header.samplerate ); - return d->frame.header.duration.seconds * d->frame.header.samplerate; -*/ + + // long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); +// mad_header_decode( (struct mad_header *)&d->frame.header, &d->stream ); +// qDebug( "LibMadPlugin::audioSamples: %i*%i", d->frame.header.duration.seconds, d->frame.header.samplerate ); +// return d->frame.header.duration.seconds * d->frame.header.samplerate; + return 10000000; } @@ -781,9 +781,9 @@ double LibMadPlugin::getTime() { } void LibMadPlugin::printID3Tags() { - debugMsg( "LibMadPlugin::printID3Tags" ); + qDebug( "LibMadPlugin::printID3Tags" ); char id3v1[128 + 1]; if ( ::lseek( d->input.fd, -128, SEEK_END ) == -1 ) { diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index ff156f8..7c76400 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp @@ -220,10 +220,11 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) audioView->addColumn(tr("Media"),-1); audioView->setColumnAlignment(1, Qt::AlignRight); audioView->setColumnAlignment(2, Qt::AlignRight); audioView->setAllColumnsShowFocus(TRUE); -// audioView->setMultiSelection( TRUE ); -// audioView->setSelectionMode( QListView::Extended); + + audioView->setMultiSelection( TRUE ); + audioView->setSelectionMode( QListView::Extended); tabWidget->insertTab(aTab,tr("Audio")); QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); @@ -245,10 +246,10 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) videoView->addColumn(tr("Media"),-1); videoView->setColumnAlignment(1, Qt::AlignRight); videoView->setColumnAlignment(2, Qt::AlignRight); videoView->setAllColumnsShowFocus(TRUE); -// videoView->setMultiSelection( TRUE ); -// videoView->setSelectionMode( QListView::Extended); + videoView->setMultiSelection( TRUE ); + videoView->setSelectionMode( QListView::Extended); QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); @@ -679,39 +680,56 @@ void PlayListWidget::addSelected() { switch (tabWidget->currentPageIndex()) { case 0: //playlist break; case 1: { //audio - for ( int i = 0; i < noOfFiles; i++ ) { - QString entryName; - entryName.sprintf( "File%i", i + 1 ); - QString linkFile = cfg.readEntry( entryName ); - if( DocLnk( linkFile).name() == audioView->selectedItem()->text(0) ) { - int result= QMessageBox::warning(this,tr("OpiePlayer"), - tr("This is all ready in your playlist.\nContinue?"), - tr("Yes"),tr("No"),0,0,1); - if (result !=0) - return; - } +// QString entryName; +// entryName.sprintf( "File%i", i + 1 ); +// QString linkFile = cfg.readEntry( entryName ); + 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); + } } - addToSelection( audioView->selectedItem() ); - tabWidget->setCurrentPage(1); + tabWidget->setCurrentPage(0); } break; case 2: { // video - for ( int i = 0; i < noOfFiles; i++ ) { - QString entryName; - entryName.sprintf( "File%i", i + 1 ); - QString linkFile = cfg.readEntry( entryName ); - if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) { - int result= QMessageBox::warning(this,tr("OpiePlayer"), - tr("This is all ready in your playlist.\nContinue?"), - tr("Yes"),tr("No"),0,0,1); - if (result !=0) - return; - } + 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); + } } - addToSelection( videoView->selectedItem() ); - tabWidget->setCurrentPage(2); +// for ( int i = 0; i < noOfFiles; i++ ) { +// QString entryName; +// entryName.sprintf( "File%i", i + 1 ); +// QString linkFile = cfg.readEntry( entryName ); +// if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) { +// int result= QMessageBox::warning(this,tr("OpiePlayer"), +// tr("This is all ready in your playlist.\nContinue?"), +// tr("Yes"),tr("No"),0,0,1); +// if (result !=0) +// return; +// } +// } +// addToSelection( videoView->selectedItem() ); + tabWidget->setCurrentPage(0); } break; }; } |