author | bipolar <bipolar> | 2002-03-03 17:13:17 (UTC) |
---|---|---|
committer | bipolar <bipolar> | 2002-03-03 17:13:17 (UTC) |
commit | a99347380a9006ec81a9dba2340d6aaab690a86e (patch) (unidiff) | |
tree | 73fdc2eff476fba2113172ed881dd64a4031def6 /core/multimedia/opieplayer/playlistwidget.cpp | |
parent | 0e245156b28b70be5cd98a58a9256fe5e2739562 (diff) | |
download | opie-a99347380a9006ec81a9dba2340d6aaab690a86e.zip opie-a99347380a9006ec81a9dba2340d6aaab690a86e.tar.gz opie-a99347380a9006ec81a9dba2340d6aaab690a86e.tar.bz2 |
commited by ljp (llornkcor) reverted to qpe's interface for compatibility. Added playlist features:
save, remove, and have different ones. Uncommented code for background image and added opielogo.
Diffstat (limited to 'core/multimedia/opieplayer/playlistwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 263 |
1 files changed, 188 insertions, 75 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 202f351..7862d8d 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -17,6 +17,7 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 | ||
20 | 21 | ||
21 | #include <qpe/qpemenubar.h> | 22 | #include <qpe/qpemenubar.h> |
22 | #include <qpe/qpetoolbar.h> | 23 | #include <qpe/qpetoolbar.h> |
@@ -40,12 +41,18 @@ | |||
40 | #include <qtabwidget.h> | 41 | #include <qtabwidget.h> |
41 | #include <qlistview.h> | 42 | #include <qlistview.h> |
42 | #include <qpoint.h> | 43 | #include <qpoint.h> |
44 | #include <qlineedit.h> | ||
45 | #include <qpushbutton.h> | ||
46 | |||
43 | //#include <qtimer.h> | 47 | //#include <qtimer.h> |
44 | 48 | ||
45 | #include "playlistselection.h" | 49 | #include "playlistselection.h" |
46 | #include "playlistwidget.h" | 50 | #include "playlistwidget.h" |
47 | #include "mediaplayerstate.h" | 51 | #include "mediaplayerstate.h" |
48 | 52 | ||
53 | #include "fileBrowser.h" | ||
54 | #include "inputDialog.h" | ||
55 | |||
49 | #include <stdlib.h> | 56 | #include <stdlib.h> |
50 | 57 | ||
51 | #define BUTTONS_ON_TOOLBAR | 58 | #define BUTTONS_ON_TOOLBAR |
@@ -119,11 +126,25 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
119 | 126 | ||
120 | QPEToolBar *bar = new QPEToolBar( this ); | 127 | QPEToolBar *bar = new QPEToolBar( this ); |
121 | bar->setLabel( tr( "Play Operations" ) ); | 128 | bar->setLabel( tr( "Play Operations" ) ); |
122 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),"mpegplayer/add_to_playlist",this , SLOT(addSelected()) ); | 129 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "mpegplayer/play_current_list", |
123 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", this , SLOT(removeSelected()) ); | 130 | // this , SLOT( addSelected()) ); |
124 | d->tbPlay = new ToolButton( bar, tr( "Play" ),"mpegplayer/play", mediaPlayerState, SLOT( setPlaying(bool)), TRUE ); | 131 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("close"),"",bar,"close"); |
125 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ), "mpegplayer/shuffle", mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 132 | tbDeletePlaylist->setFlat(TRUE); |
126 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"mpegplayer/loop", mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 133 | tbDeletePlaylist->setFixedSize(20,20); |
134 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); | ||
135 | |||
136 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", | ||
137 | this , SLOT(addSelected()) ); | ||
138 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", | ||
139 | this , SLOT(removeSelected()) ); | ||
140 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); | ||
141 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", | ||
142 | this , SLOT( btnPlay(bool) ), TRUE ); | ||
143 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"mpegplayer/shuffle", | ||
144 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | ||
145 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"mpegplayer/loop", | ||
146 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | ||
147 | tbDeletePlaylist->hide(); | ||
127 | 148 | ||
128 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 149 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
129 | menu->insertItem( tr( "File" ), pmPlayList ); | 150 | menu->insertItem( tr( "File" ), pmPlayList ); |
@@ -132,7 +153,7 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
132 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 153 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
133 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 154 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
134 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 155 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
135 | new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); | 156 | // new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) ); |
136 | 157 | ||
137 | QPopupMenu *pmView = new QPopupMenu( this ); | 158 | QPopupMenu *pmView = new QPopupMenu( this ); |
138 | menu->insertItem( tr( "View" ), pmView ); | 159 | menu->insertItem( tr( "View" ), pmView ); |
@@ -228,35 +249,39 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
228 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); | 249 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); |
229 | } | 250 | } |
230 | } | 251 | } |
252 | |||
253 | //playlists list | ||
254 | QWidget *LTab; | ||
255 | LTab = new QWidget( tabWidget, "LTab" ); | ||
256 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy | ||
257 | playLists->setMinimumSize(233,260);; | ||
258 | tabWidget->insertTab(LTab,"Lists"); | ||
259 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); | ||
260 | // connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); | ||
261 | |||
262 | |||
231 | // add the library area | 263 | // add the library area |
232 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 264 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
233 | 265 | ||
234 | // connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | ||
235 | // connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | ||
236 | 266 | ||
237 | connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 267 | connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), |
238 | connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 268 | this, SLOT( fauxPlay( QListViewItem *) ) ); |
269 | connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), | ||
270 | this, SLOT( fauxPlay( QListViewItem *)) ); | ||
239 | 271 | ||
240 | connect( audioView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ), | 272 | // connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); |
241 | this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) ); | 273 | // connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); |
242 | connect( videoView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint&, int ) ), | ||
243 | this, SLOT( addToSelection( QListViewItem *, const QPoint&, int )) ); | ||
244 | 274 | ||
275 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | ||
276 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | ||
245 | 277 | ||
246 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); | 278 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); |
247 | // connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | ||
248 | // connect( d->files, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | ||
249 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 279 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
250 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 280 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
251 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 281 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
252 | |||
253 | // connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setOn( bool ) ) ); | ||
254 | // connect( mediaPlayerState, SIGNAL( scaledToggled( bool ) ), scaleButton, SLOT( setEnabled( bool ) ) ); | ||
255 | // connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), fullScreenButton, SLOT( setEnabled( bool ) ) ); | ||
256 | |||
257 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 282 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
258 | 283 | ||
259 | connect( d->selectedFiles, SIGNAL( clicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | 284 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); |
260 | // connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); | 285 | // connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) ); |
261 | 286 | ||
262 | setCentralWidget( vbox5 ); | 287 | setCentralWidget( vbox5 ); |
@@ -287,6 +312,9 @@ void PlayListWidget::initializeStates() { | |||
287 | // d->tbScale->setOn( mediaPlayerState->scaled() ); | 312 | // d->tbScale->setOn( mediaPlayerState->scaled() ); |
288 | // d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); | 313 | // d->tbScale->setEnabled( mediaPlayerState->fullscreen() ); |
289 | // setPlaylist( mediaPlayerState->playlist() ); | 314 | // setPlaylist( mediaPlayerState->playlist() ); |
315 | setPlaylist( true); | ||
316 | d->selectedFiles->first(); | ||
317 | |||
290 | } | 318 | } |
291 | 319 | ||
292 | 320 | ||
@@ -302,7 +330,6 @@ void PlayListWidget::readConfig( Config& cfg ) { | |||
302 | DocLnk lnk( linkFile ); | 330 | DocLnk lnk( linkFile ); |
303 | if ( lnk.isValid() ) | 331 | if ( lnk.isValid() ) |
304 | d->selectedFiles->addToSelection( lnk ); | 332 | d->selectedFiles->addToSelection( lnk ); |
305 | |||
306 | } | 333 | } |
307 | } | 334 | } |
308 | 335 | ||
@@ -339,10 +366,13 @@ void PlayListWidget::writeConfig( Config& cfg ) const { | |||
339 | } while ( d->selectedFiles->next() ); | 366 | } while ( d->selectedFiles->next() ); |
340 | 367 | ||
341 | cfg.writeEntry("NumberOfFiles", noOfFiles ); | 368 | cfg.writeEntry("NumberOfFiles", noOfFiles ); |
369 | |||
370 | |||
342 | } | 371 | } |
343 | 372 | ||
344 | 373 | ||
345 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 374 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
375 | qDebug("add"); | ||
346 | d->setDocumentUsed = FALSE; | 376 | d->setDocumentUsed = FALSE; |
347 | if ( mediaPlayerState->playlist() ) | 377 | if ( mediaPlayerState->playlist() ) |
348 | d->selectedFiles->addToSelection( lnk ); | 378 | d->selectedFiles->addToSelection( lnk ); |
@@ -351,16 +381,6 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) { | |||
351 | } | 381 | } |
352 | 382 | ||
353 | 383 | ||
354 | void PlayListWidget::addToSelection( QListViewItem *it ,const QPoint & p, int index) { | ||
355 | qDebug("add"); | ||
356 | // d->selectedFiles->addToSelection( lnk ); | ||
357 | // } | ||
358 | // else | ||
359 | // mediaPlayerState->setPlaying( TRUE ); | ||
360 | // | ||
361 | } | ||
362 | |||
363 | |||
364 | void PlayListWidget::clearList() { | 384 | void PlayListWidget::clearList() { |
365 | while ( first() ) | 385 | while ( first() ) |
366 | d->selectedFiles->removeSelected(); | 386 | d->selectedFiles->removeSelected(); |
@@ -426,13 +446,17 @@ void PlayListWidget::useSelectedDocument() { | |||
426 | 446 | ||
427 | 447 | ||
428 | const DocLnk *PlayListWidget::current() { | 448 | const DocLnk *PlayListWidget::current() { |
429 | if ( mediaPlayerState->playlist() ) | 449 | |
450 | // qDebug("in Playlist widget ::current"); | ||
451 | if ( mediaPlayerState->playlist() ) { | ||
430 | return d->selectedFiles->current(); | 452 | return d->selectedFiles->current(); |
453 | } | ||
431 | else if ( d->setDocumentUsed && d->current ) { | 454 | else if ( d->setDocumentUsed && d->current ) { |
432 | return d->current; | 455 | return d->current; |
433 | } else | 456 | } else { |
434 | return d->files->selected(); | 457 | return d->files->selected(); |
435 | } | 458 | } |
459 | } | ||
436 | 460 | ||
437 | 461 | ||
438 | bool PlayListWidget::prev() { | 462 | bool PlayListWidget::prev() { |
@@ -501,20 +525,48 @@ bool PlayListWidget::last() { | |||
501 | 525 | ||
502 | 526 | ||
503 | void PlayListWidget::saveList() { | 527 | void PlayListWidget::saveList() { |
528 | |||
504 | QString filename; | 529 | QString filename; |
505 | // pseudo code | 530 | InputDialog *fileDlg; |
506 | // filename = QLineEdit->getText(); | 531 | fileDlg=new InputDialog(this,"Save Playlist",TRUE, 0); |
532 | fileDlg->exec(); | ||
533 | if( fileDlg->result() == 1 ) { | ||
534 | filename = fileDlg->LineEdit1->text();//+".playlist"; | ||
535 | qDebug("saving playlist "+filename+".playlist"); | ||
536 | |||
537 | // DocLnk *lnk; | ||
538 | // lnk.setName( filename); //sets file name | ||
539 | // // lnk.setComment(title); | ||
540 | // lnk.setFile( filename+".playlist"); //sets File property | ||
541 | // lnk.setType("player/plain");// hey is this a REGISTERED mime type?!?!? ;D | ||
542 | // lnk.setIcon("MPEGPlayer"); | ||
543 | // if(!lnk.writeLink()) | ||
544 | // qDebug("Writing doclink did not work"); | ||
545 | |||
507 | Config cfg( filename + ".playlist" ); | 546 | Config cfg( filename + ".playlist" ); |
508 | writeConfig( cfg ); | 547 | writeConfig( cfg ); |
509 | } | 548 | } |
549 | DocLnk lnk; | ||
550 | lnk.setName( filename); //sets file name | ||
551 | // lnk.setComment(title); | ||
552 | lnk.setFile(QPEApplication::qpeDir()+"Settings/"+filename+".playlist.conf"); //sets File property | ||
553 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D | ||
554 | lnk.setIcon("MPEGPlayer"); | ||
555 | if(!lnk.writeLink()) | ||
556 | qDebug("Writing doclink did not work"); | ||
510 | 557 | ||
558 | if(fileDlg) | ||
559 | delete fileDlg; | ||
560 | } | ||
511 | 561 | ||
512 | void PlayListWidget::loadList() { | 562 | |
513 | QString filename; | 563 | void PlayListWidget::loadList( const DocLnk & lnk) { |
514 | // pseudo code | 564 | |
515 | // filename = FileSelector->openFile( "*.playlist" ); | 565 | clearList(); |
516 | Config cfg( filename + ".playlist" ); | 566 | Config cfg( lnk.file()); |
517 | readConfig( cfg ); | 567 | readConfig( cfg ); |
568 | tabWidget->setCurrentPage(0); | ||
569 | setCaption("OpiePlayer: "+lnk.name()); | ||
518 | } | 570 | } |
519 | 571 | ||
520 | 572 | ||
@@ -534,9 +586,8 @@ void PlayListWidget::setView( char view ) { | |||
534 | } | 586 | } |
535 | 587 | ||
536 | void PlayListWidget::addSelected() { | 588 | void PlayListWidget::addSelected() { |
537 | // QMessageBox::message("Note","Bozo the clown thinks\nthere's something actually here"); | 589 | |
538 | int tabPage=tabWidget->currentPageIndex(); | 590 | switch (tabWidget->currentPageIndex()) { |
539 | switch (tabPage) { | ||
540 | case 0: //playlist | 591 | case 0: //playlist |
541 | break; | 592 | break; |
542 | case 1: { //audio | 593 | case 1: { //audio |
@@ -557,19 +608,20 @@ void PlayListWidget::removeSelected() { | |||
557 | 608 | ||
558 | void PlayListWidget::playIt( QListViewItem *it) { | 609 | void PlayListWidget::playIt( QListViewItem *it) { |
559 | // d->setDocumentUsed = FALSE; | 610 | // d->setDocumentUsed = FALSE; |
560 | mediaPlayerState->setPlaying(true); | 611 | mediaPlayerState->setPlaying(TRUE); |
561 | } | 612 | } |
562 | 613 | ||
563 | void PlayListWidget::addToSelection( QListViewItem *it) { | 614 | void PlayListWidget::addToSelection( QListViewItem *it) { |
564 | d->setDocumentUsed = FALSE; | 615 | d->setDocumentUsed = FALSE; |
565 | 616 | ||
566 | if(it) { | 617 | if(it) { |
567 | qDebug("add to selection"); | 618 | // qDebug("add to selection"); |
568 | int tabPage=tabWidget->currentPageIndex(); | 619 | switch (tabWidget->currentPageIndex()) { |
569 | switch (tabPage) { | ||
570 | case 1: { | 620 | case 1: { |
621 | // qDebug("case 1"); | ||
571 | QListIterator<DocLnk> dit( files.children() ); | 622 | QListIterator<DocLnk> dit( files.children() ); |
572 | for ( ; dit.current(); ++dit ) { | 623 | for ( ; dit.current(); ++dit ) { |
624 | // qDebug(dit.current()->name()); | ||
573 | if( dit.current()->name() == it->text(0)) { | 625 | if( dit.current()->name() == it->text(0)) { |
574 | d->selectedFiles->addToSelection( **dit ); | 626 | d->selectedFiles->addToSelection( **dit ); |
575 | } | 627 | } |
@@ -577,9 +629,10 @@ void PlayListWidget::addToSelection( QListViewItem *it) { | |||
577 | } | 629 | } |
578 | break; | 630 | break; |
579 | case 2: { | 631 | case 2: { |
632 | // qDebug("case 2"); | ||
580 | QListIterator<DocLnk> dit( vFiles.children() ); | 633 | QListIterator<DocLnk> dit( vFiles.children() ); |
581 | for ( ; dit.current(); ++dit ) { | 634 | for ( ; dit.current(); ++dit ) { |
582 | qDebug(dit.current()->name()); | 635 | // qDebug(dit.current()->name()); |
583 | if( dit.current()->name() == it->text(0)) { | 636 | if( dit.current()->name() == it->text(0)) { |
584 | d->selectedFiles->addToSelection( **dit ); | 637 | d->selectedFiles->addToSelection( **dit ); |
585 | } | 638 | } |
@@ -596,54 +649,114 @@ void PlayListWidget::addToSelection( QListViewItem *it) { | |||
596 | 649 | ||
597 | void PlayListWidget::tabChanged(QWidget *widg) { | 650 | void PlayListWidget::tabChanged(QWidget *widg) { |
598 | 651 | ||
599 | int tabPage=tabWidget->currentPageIndex(); | 652 | switch ( tabWidget->currentPageIndex()) { |
600 | switch (tabPage) { | ||
601 | case 0: | 653 | case 0: |
602 | { | 654 | { |
655 | if( !tbDeletePlaylist->isHidden()) | ||
656 | tbDeletePlaylist->hide(); | ||
603 | d->tbRemoveFromList->setEnabled(TRUE); | 657 | d->tbRemoveFromList->setEnabled(TRUE); |
604 | d->tbAddToList->setEnabled(FALSE); | 658 | d->tbAddToList->setEnabled(FALSE); |
605 | } | 659 | } |
606 | break; | 660 | break; |
607 | case 1: | 661 | case 1: |
608 | { | 662 | { |
663 | if( !tbDeletePlaylist->isHidden()) | ||
664 | tbDeletePlaylist->hide(); | ||
609 | d->tbRemoveFromList->setEnabled(FALSE); | 665 | d->tbRemoveFromList->setEnabled(FALSE); |
610 | d->tbAddToList->setEnabled(TRUE); | 666 | d->tbAddToList->setEnabled(TRUE); |
611 | } | 667 | } |
612 | break; | 668 | break; |
613 | case 2: | 669 | case 2: |
614 | { | 670 | { |
671 | if( !tbDeletePlaylist->isHidden()) | ||
672 | tbDeletePlaylist->hide(); | ||
615 | d->tbRemoveFromList->setEnabled(FALSE); | 673 | d->tbRemoveFromList->setEnabled(FALSE); |
616 | d->tbAddToList->setEnabled(TRUE); | 674 | d->tbAddToList->setEnabled(TRUE); |
617 | } | 675 | } |
618 | break; | 676 | break; |
677 | case 3: | ||
678 | { | ||
679 | if( tbDeletePlaylist->isHidden()) | ||
680 | tbDeletePlaylist->show(); | ||
681 | playLists->reread(); | ||
682 | } | ||
683 | break; | ||
619 | }; | 684 | }; |
620 | } | 685 | } |
621 | 686 | ||
622 | // void PlayListWidget::cancelMenuTimer() { | 687 | /* |
623 | // if( menuTimer->isActive() ) | 688 | list is right clicked*/ |
624 | // menuTimer->stop(); | 689 | void PlayListWidget::fauxPlay(QListViewItem *it) { |
625 | // } | ||
626 | 690 | ||
627 | // void PlayListWidget::showFileMenu() { | 691 | switch (tabWidget->currentPageIndex()) { |
628 | 692 | case 0: //playlist | |
629 | // } | 693 | break; |
694 | case 1: { //audio | ||
695 | QListIterator<DocLnk> dit( files.children() ); | ||
696 | for ( ; dit.current(); ++dit ) { | ||
697 | // qDebug(dit.current()->name()); | ||
698 | if( dit.current()->name() == it->text(0)) { | ||
699 | d->selectedFiles->addToSelection( **dit ); | ||
700 | } | ||
701 | } | ||
702 | } | ||
703 | break; | ||
704 | case 2: { // video | ||
705 | QListIterator<DocLnk> dit( vFiles.children() ); | ||
706 | for ( ; dit.current(); ++dit ) { | ||
707 | // qDebug(dit.current()->name()); | ||
708 | if( dit.current()->name() == it->text(0)) { | ||
709 | d->selectedFiles->addToSelection( **dit ); | ||
710 | } | ||
711 | } | ||
712 | } | ||
713 | break; | ||
714 | }; | ||
715 | mediaPlayerState->setPlaying( TRUE ); | ||
716 | // tabWidget->setCurrentPage(0); | ||
717 | d->selectedFiles->removeSelected(); | ||
718 | } | ||
630 | 719 | ||
631 | // void PlayListWidget::contentsMousePressEvent( QMouseEvent * e ) | 720 | /* |
632 | // { | 721 | play button is pressed*/ |
633 | // // QListView::contentsMousePressEvent( e ); | 722 | void PlayListWidget::btnPlay(bool b) { // this is fugly |
634 | // menuTimer->start( 750, TRUE ); | 723 | switch ( tabWidget->currentPageIndex()) { |
635 | // } | 724 | case 0: |
725 | { | ||
726 | mediaPlayerState->setPlaying(b); | ||
727 | } | ||
728 | break; | ||
729 | case 1: | ||
730 | { | ||
731 | addToSelection( audioView->selectedItem() ); | ||
732 | mediaPlayerState->setPlaying(b); | ||
733 | d->selectedFiles->removeSelected( ); | ||
734 | tabWidget->setCurrentPage(1); | ||
735 | } | ||
736 | break; | ||
737 | case 2: | ||
738 | { | ||
739 | addToSelection( videoView->selectedItem() ); | ||
740 | mediaPlayerState->setPlaying(b); | ||
741 | d->selectedFiles->removeSelected( ); | ||
742 | tabWidget->setCurrentPage(2); | ||
743 | } | ||
744 | break; | ||
745 | }; | ||
636 | 746 | ||
747 | } | ||
637 | 748 | ||
638 | // void PlayListWidget::contentsMouseReleaseEvent( QMouseEvent * e ) | 749 | void PlayListWidget::deletePlaylist() { |
639 | // { | 750 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
640 | // // QListView::contentsMouseReleaseEvent( e ); | 751 | (tr("You really want to delete\nthis playlist?")), |
641 | // menuTimer->stop(); | 752 | (tr("Yes")), (tr("No")), 0 )){ |
642 | // } | 753 | case 0: // Yes clicked, |
643 | // // void PlayListWidget::setFullScreen() { | 754 | QFile().remove(playLists->selected()->file()); |
644 | // mediaPlayerState->toggleFullscreen( ); | 755 | QFile().remove(playLists->selected()->linkFile()); |
645 | // } | 756 | playLists->reread(); |
757 | break; | ||
758 | case 1: // Cancel | ||
759 | break; | ||
760 | }; | ||
646 | 761 | ||
647 | // void PlayListWidget::setScaled() { | 762 | } |
648 | // mediaPlayerState->toggleScaled(); | ||
649 | // } | ||