author | llornkcor <llornkcor> | 2002-04-21 15:49:37 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-21 15:49:37 (UTC) |
commit | d7ff40e1530a1aab578a3d3c3126c4367cf3e898 (patch) (unidiff) | |
tree | c581ad533a4cbb7a0fbbcaa9f624ae8f9475adde /core/multimedia/opieplayer/playlistwidget.cpp | |
parent | a588c90b0191e837b472dcaa76a5dedc289a5b10 (diff) | |
download | opie-d7ff40e1530a1aab578a3d3c3126c4367cf3e898.zip opie-d7ff40e1530a1aab578a3d3c3126c4367cf3e898.tar.gz opie-d7ff40e1530a1aab578a3d3c3126c4367cf3e898.tar.bz2 |
added multiselect to playlist
Diffstat (limited to 'core/multimedia/opieplayer/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 78 |
1 files changed, 48 insertions, 30 deletions
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 | |||
@@ -212,51 +212,52 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
212 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 212 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
213 | 213 | ||
214 | QWidget *aTab; | 214 | QWidget *aTab; |
215 | aTab = new QWidget( tabWidget, "aTab" ); | 215 | aTab = new QWidget( tabWidget, "aTab" ); |
216 | audioView = new QListView( aTab, "Audioview" ); | 216 | audioView = new QListView( aTab, "Audioview" ); |
217 | audioView->setMinimumSize(233,260); | 217 | audioView->setMinimumSize(233,260); |
218 | audioView->addColumn( tr("Title"),140); | 218 | audioView->addColumn( tr("Title"),140); |
219 | audioView->addColumn(tr("Size"), -1); | 219 | audioView->addColumn(tr("Size"), -1); |
220 | audioView->addColumn(tr("Media"),-1); | 220 | audioView->addColumn(tr("Media"),-1); |
221 | audioView->setColumnAlignment(1, Qt::AlignRight); | 221 | audioView->setColumnAlignment(1, Qt::AlignRight); |
222 | audioView->setColumnAlignment(2, Qt::AlignRight); | 222 | audioView->setColumnAlignment(2, Qt::AlignRight); |
223 | audioView->setAllColumnsShowFocus(TRUE); | 223 | audioView->setAllColumnsShowFocus(TRUE); |
224 | // audioView->setMultiSelection( TRUE ); | 224 | |
225 | // audioView->setSelectionMode( QListView::Extended); | 225 | audioView->setMultiSelection( TRUE ); |
226 | audioView->setSelectionMode( QListView::Extended); | ||
226 | 227 | ||
227 | tabWidget->insertTab(aTab,tr("Audio")); | 228 | tabWidget->insertTab(aTab,tr("Audio")); |
228 | 229 | ||
229 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); | 230 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); |
230 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 231 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
231 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 232 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
232 | 233 | ||
233 | 234 | ||
234 | // audioView | 235 | // audioView |
235 | populateAudioView(); | 236 | populateAudioView(); |
236 | // videowidget | 237 | // videowidget |
237 | 238 | ||
238 | QWidget *vTab; | 239 | QWidget *vTab; |
239 | vTab = new QWidget( tabWidget, "vTab" ); | 240 | vTab = new QWidget( tabWidget, "vTab" ); |
240 | videoView = new QListView( vTab, "Videoview" ); | 241 | videoView = new QListView( vTab, "Videoview" ); |
241 | videoView->setMinimumSize(233,260); | 242 | videoView->setMinimumSize(233,260); |
242 | 243 | ||
243 | videoView->addColumn(tr("Title"),140); | 244 | videoView->addColumn(tr("Title"),140); |
244 | videoView->addColumn(tr("Size"),-1); | 245 | videoView->addColumn(tr("Size"),-1); |
245 | videoView->addColumn(tr("Media"),-1); | 246 | videoView->addColumn(tr("Media"),-1); |
246 | videoView->setColumnAlignment(1, Qt::AlignRight); | 247 | videoView->setColumnAlignment(1, Qt::AlignRight); |
247 | videoView->setColumnAlignment(2, Qt::AlignRight); | 248 | videoView->setColumnAlignment(2, Qt::AlignRight); |
248 | videoView->setAllColumnsShowFocus(TRUE); | 249 | videoView->setAllColumnsShowFocus(TRUE); |
249 | // videoView->setMultiSelection( TRUE ); | 250 | videoView->setMultiSelection( TRUE ); |
250 | // videoView->setSelectionMode( QListView::Extended); | 251 | videoView->setSelectionMode( QListView::Extended); |
251 | 252 | ||
252 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); | 253 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); |
253 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 254 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
254 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 255 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
255 | 256 | ||
256 | tabWidget->insertTab( vTab,tr("Video")); | 257 | tabWidget->insertTab( vTab,tr("Video")); |
257 | populateVideoView(); | 258 | populateVideoView(); |
258 | 259 | ||
259 | //playlists list | 260 | //playlists list |
260 | QWidget *LTab; | 261 | QWidget *LTab; |
261 | LTab = new QWidget( tabWidget, "LTab" ); | 262 | LTab = new QWidget( tabWidget, "LTab" ); |
262 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy | 263 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy |
@@ -671,55 +672,72 @@ void PlayListWidget::setView( char view ) { | |||
671 | 672 | ||
672 | void PlayListWidget::addSelected() { | 673 | void PlayListWidget::addSelected() { |
673 | 674 | ||
674 | Config cfg( "OpiePlayer" ); | 675 | Config cfg( "OpiePlayer" ); |
675 | cfg.setGroup("PlayList"); | 676 | cfg.setGroup("PlayList"); |
676 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 677 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
677 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 678 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
678 | 679 | ||
679 | switch (tabWidget->currentPageIndex()) { | 680 | switch (tabWidget->currentPageIndex()) { |
680 | case 0: //playlist | 681 | case 0: //playlist |
681 | break; | 682 | break; |
682 | case 1: { //audio | 683 | case 1: { //audio |
683 | for ( int i = 0; i < noOfFiles; i++ ) { | 684 | // QString entryName; |
684 | QString entryName; | 685 | // entryName.sprintf( "File%i", i + 1 ); |
685 | entryName.sprintf( "File%i", i + 1 ); | 686 | // QString linkFile = cfg.readEntry( entryName ); |
686 | QString linkFile = cfg.readEntry( entryName ); | 687 | QListViewItemIterator it( audioView ); |
687 | if( DocLnk( linkFile).name() == audioView->selectedItem()->text(0) ) { | 688 | // iterate through all items of the listview |
688 | int result= QMessageBox::warning(this,tr("OpiePlayer"), | 689 | for ( ; it.current(); ++it ) { |
689 | tr("This is all ready in your playlist.\nContinue?"), | 690 | if ( it.current()->isSelected() ) { |
690 | tr("Yes"),tr("No"),0,0,1); | 691 | QListIterator<DocLnk> dit( files.children() ); |
691 | if (result !=0) | 692 | for ( ; dit.current(); ++dit ) { |
692 | return; | 693 | if( dit.current()->name() == it.current()->text(0) ) { |
693 | } | 694 | d->selectedFiles->addToSelection( **dit ); |
695 | } | ||
696 | } | ||
697 | audioView->setSelected( it.current(),FALSE); | ||
698 | } | ||
694 | } | 699 | } |
695 | addToSelection( audioView->selectedItem() ); | 700 | tabWidget->setCurrentPage(0); |
696 | tabWidget->setCurrentPage(1); | ||
697 | } | 701 | } |
698 | break; | 702 | break; |
699 | case 2: { // video | 703 | case 2: { // video |
700 | for ( int i = 0; i < noOfFiles; i++ ) { | 704 | QListViewItemIterator it( videoView ); |
701 | QString entryName; | 705 | // iterate through all items of the listview |
702 | entryName.sprintf( "File%i", i + 1 ); | 706 | for ( ; it.current(); ++it ) { |
703 | QString linkFile = cfg.readEntry( entryName ); | 707 | if ( it.current()->isSelected() ) { |
704 | if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) { | 708 | QListIterator<DocLnk> dit( vFiles.children() ); |
705 | int result= QMessageBox::warning(this,tr("OpiePlayer"), | 709 | for ( ; dit.current(); ++dit ) { |
706 | tr("This is all ready in your playlist.\nContinue?"), | 710 | if( dit.current()->name() == it.current()->text(0) ) { |
707 | tr("Yes"),tr("No"),0,0,1); | 711 | d->selectedFiles->addToSelection( **dit ); |
708 | if (result !=0) | 712 | } |
709 | return; | 713 | } |
710 | } | 714 | |
715 | videoView->setSelected( it.current(),FALSE); | ||
716 | } | ||
711 | } | 717 | } |
712 | addToSelection( videoView->selectedItem() ); | 718 | // for ( int i = 0; i < noOfFiles; i++ ) { |
713 | tabWidget->setCurrentPage(2); | 719 | // QString entryName; |
720 | // entryName.sprintf( "File%i", i + 1 ); | ||
721 | // QString linkFile = cfg.readEntry( entryName ); | ||
722 | // if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) { | ||
723 | // int result= QMessageBox::warning(this,tr("OpiePlayer"), | ||
724 | // tr("This is all ready in your playlist.\nContinue?"), | ||
725 | // tr("Yes"),tr("No"),0,0,1); | ||
726 | // if (result !=0) | ||
727 | // return; | ||
728 | // } | ||
729 | // } | ||
730 | // addToSelection( videoView->selectedItem() ); | ||
731 | tabWidget->setCurrentPage(0); | ||
714 | } | 732 | } |
715 | break; | 733 | break; |
716 | }; | 734 | }; |
717 | } | 735 | } |
718 | 736 | ||
719 | void PlayListWidget::removeSelected() { | 737 | void PlayListWidget::removeSelected() { |
720 | d->selectedFiles->removeSelected( ); | 738 | d->selectedFiles->removeSelected( ); |
721 | } | 739 | } |
722 | 740 | ||
723 | void PlayListWidget::playIt( QListViewItem *it) { | 741 | void PlayListWidget::playIt( QListViewItem *it) { |
724 | // d->setDocumentUsed = FALSE; | 742 | // d->setDocumentUsed = FALSE; |
725 | mediaPlayerState->setPlaying(TRUE); | 743 | mediaPlayerState->setPlaying(TRUE); |