-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index b6525e1..897c458 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -109,96 +109,97 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
109 | d->selectedFiles, SLOT(removeSelected() ) ); | 109 | d->selectedFiles, SLOT(removeSelected() ) ); |
110 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", | 110 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", |
111 | d->selectedFiles, SLOT(moveSelectedDown() ) ); | 111 | d->selectedFiles, SLOT(moveSelectedDown() ) ); |
112 | QVBox *stretch2 = new QVBox( vbox1 ); | 112 | QVBox *stretch2 = new QVBox( vbox1 ); |
113 | 113 | ||
114 | connect( tbDeletePlaylist, ( SIGNAL( released() ) ), | 114 | connect( tbDeletePlaylist, ( SIGNAL( released() ) ), |
115 | SLOT( deletePlaylist() ) ); | 115 | SLOT( deletePlaylist() ) ); |
116 | connect( pmView, SIGNAL( activated( int ) ), | 116 | connect( pmView, SIGNAL( activated( int ) ), |
117 | this, SLOT( pmViewActivated( int ) ) ); | 117 | this, SLOT( pmViewActivated( int ) ) ); |
118 | connect( skinsMenu, SIGNAL( activated( int ) ) , | 118 | connect( skinsMenu, SIGNAL( activated( int ) ) , |
119 | this, SLOT( skinsMenuActivated( int ) ) ); | 119 | this, SLOT( skinsMenuActivated( int ) ) ); |
120 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), | 120 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), |
121 | this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); | 121 | this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); |
122 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), | 122 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), |
123 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); | 123 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); |
124 | connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), | 124 | connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), |
125 | this,SLOT( playIt( QListViewItem *) ) ); | 125 | this,SLOT( playIt( QListViewItem *) ) ); |
126 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), | 126 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), |
127 | this, SLOT( addToSelection( QListViewItem *) ) ); | 127 | this, SLOT( addToSelection( QListViewItem *) ) ); |
128 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), | 128 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), |
129 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); | 129 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); |
130 | connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), | 130 | connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), |
131 | this,SLOT( playIt( QListViewItem *) ) ); | 131 | this,SLOT( playIt( QListViewItem *) ) ); |
132 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), | 132 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), |
133 | this, SLOT( addToSelection( QListViewItem *) ) ); | 133 | this, SLOT( addToSelection( QListViewItem *) ) ); |
134 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), | 134 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), |
135 | this, SLOT( loadList( const DocLnk & ) ) ); | 135 | this, SLOT( loadList( const DocLnk & ) ) ); |
136 | connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), | 136 | connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), |
137 | this, SLOT( tabChanged( QWidget* ) ) ); | 137 | this, SLOT( tabChanged( QWidget* ) ) ); |
138 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), | 138 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), |
139 | d->tbPlay, SLOT( setOn( bool ) ) ); | 139 | d->tbPlay, SLOT( setOn( bool ) ) ); |
140 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), | 140 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), |
141 | d->tbLoop, SLOT( setOn( bool ) ) ); | 141 | d->tbLoop, SLOT( setOn( bool ) ) ); |
142 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), | 142 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), |
143 | d->tbShuffle, SLOT( setOn( bool ) ) ); | 143 | d->tbShuffle, SLOT( setOn( bool ) ) ); |
144 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), | 144 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), |
145 | this, SLOT( setPlaylist( bool ) ) ); | 145 | this, SLOT( setPlaylist( bool ) ) ); |
146 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), | 146 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), |
147 | this, SLOT( playIt( QListViewItem *) ) ); | 147 | this, SLOT( playIt( QListViewItem *) ) ); |
148 | connect ( gammaSlider, SIGNAL( valueChanged( int ) ), | 148 | connect ( gammaSlider, SIGNAL( valueChanged( int ) ), |
149 | mediaPlayerState, SLOT( setVideoGamma( int ) ) ); | 149 | mediaPlayerState, SLOT( setVideoGamma( int ) ) ); |
150 | 150 | ||
151 | // see which skins are installed | 151 | // see which skins are installed |
152 | videoScan=FALSE; | 152 | videoScan=FALSE; |
153 | audioScan=FALSE; | 153 | audioScan=FALSE; |
154 | populateSkinsMenu(); | 154 | populateSkinsMenu(); |
155 | initializeStates(); | 155 | initializeStates(); |
156 | 156 | ||
157 | cfg.setGroup("PlayList"); | ||
157 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "" ); | 158 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "" ); |
158 | loadList(DocLnk( currentPlaylist ) ); | 159 | loadList(DocLnk( currentPlaylist ) ); |
159 | setCaption( tr( "OpiePlayer: " ) + currentPlaylist ); | 160 | setCaption( tr( "OpiePlayer: " ) + currentPlaylist ); |
160 | } | 161 | } |
161 | 162 | ||
162 | 163 | ||
163 | PlayListWidget::~PlayListWidget() { | 164 | PlayListWidget::~PlayListWidget() { |
164 | if ( d->current ) { | 165 | if ( d->current ) { |
165 | delete d->current; | 166 | delete d->current; |
166 | } | 167 | } |
167 | delete d; | 168 | delete d; |
168 | } | 169 | } |
169 | 170 | ||
170 | 171 | ||
171 | void PlayListWidget::initializeStates() { | 172 | void PlayListWidget::initializeStates() { |
172 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 173 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
173 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 174 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
174 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); | 175 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); |
175 | setPlaylist( true ); | 176 | setPlaylist( true ); |
176 | } | 177 | } |
177 | 178 | ||
178 | 179 | ||
179 | void PlayListWidget::readConfig( Config& cfg ) { | 180 | void PlayListWidget::readConfig( Config& cfg ) { |
180 | 181 | ||
181 | cfg.setGroup( "PlayList" ); | 182 | cfg.setGroup( "PlayList" ); |
182 | QString currentString = cfg.readEntry( "current", "" ); | 183 | QString currentString = cfg.readEntry( "current", "" ); |
183 | int noOfFiles = cfg.readNumEntry( "NumberOfFiles", 0 ); | 184 | int noOfFiles = cfg.readNumEntry( "NumberOfFiles", 0 ); |
184 | 185 | ||
185 | for ( int i = 0; i < noOfFiles; i++ ) { | 186 | for ( int i = 0; i < noOfFiles; i++ ) { |
186 | QString entryName; | 187 | QString entryName; |
187 | entryName.sprintf( "File%i", i + 1 ); | 188 | entryName.sprintf( "File%i", i + 1 ); |
188 | 189 | ||
189 | QString linkFile = cfg.readEntry( entryName ); | 190 | QString linkFile = cfg.readEntry( entryName ); |
190 | 191 | ||
191 | qDebug("reading "+linkFile); | 192 | qDebug("reading "+linkFile); |
192 | 193 | ||
193 | if( QFileInfo( linkFile ).exists() ) { | 194 | if( QFileInfo( linkFile ).exists() ) { |
194 | 195 | ||
195 | DocLnk lnk( linkFile ); | 196 | DocLnk lnk( linkFile ); |
196 | 197 | ||
197 | if ( QFileInfo( lnk.file() ).exists() || | 198 | if ( QFileInfo( lnk.file() ).exists() || |
198 | 199 | ||
199 | linkFile.find( "http" , 0, TRUE) != -1) { | 200 | linkFile.find( "http" , 0, TRUE) != -1) { |
200 | 201 | ||
201 | d->selectedFiles->addToSelection( lnk ); | 202 | d->selectedFiles->addToSelection( lnk ); |
202 | } | 203 | } |
203 | } | 204 | } |
204 | } | 205 | } |
@@ -439,97 +440,97 @@ bool PlayListWidget::prev() { | |||
439 | } | 440 | } |
440 | } | 441 | } |
441 | 442 | ||
442 | 443 | ||
443 | bool PlayListWidget::next() { | 444 | bool PlayListWidget::next() { |
444 | //qDebug("<<<<<<<<<<<<next()"); | 445 | //qDebug("<<<<<<<<<<<<next()"); |
445 | if ( mediaPlayerState->playlist() ) { | 446 | if ( mediaPlayerState->playlist() ) { |
446 | if ( mediaPlayerState->shuffled() ) { | 447 | if ( mediaPlayerState->shuffled() ) { |
447 | return prev(); | 448 | return prev(); |
448 | } else { | 449 | } else { |
449 | if ( !d->selectedFiles->next() ) { | 450 | if ( !d->selectedFiles->next() ) { |
450 | if ( mediaPlayerState->looping() ) { | 451 | if ( mediaPlayerState->looping() ) { |
451 | return d->selectedFiles->first(); | 452 | return d->selectedFiles->first(); |
452 | } else { | 453 | } else { |
453 | return FALSE; | 454 | return FALSE; |
454 | } | 455 | } |
455 | } | 456 | } |
456 | return TRUE; | 457 | return TRUE; |
457 | } | 458 | } |
458 | } else { | 459 | } else { |
459 | return mediaPlayerState->looping(); | 460 | return mediaPlayerState->looping(); |
460 | } | 461 | } |
461 | } | 462 | } |
462 | 463 | ||
463 | 464 | ||
464 | bool PlayListWidget::first() { | 465 | bool PlayListWidget::first() { |
465 | if ( mediaPlayerState->playlist() ) | 466 | if ( mediaPlayerState->playlist() ) |
466 | return d->selectedFiles->first(); | 467 | return d->selectedFiles->first(); |
467 | else | 468 | else |
468 | return mediaPlayerState->looping(); | 469 | return mediaPlayerState->looping(); |
469 | } | 470 | } |
470 | 471 | ||
471 | 472 | ||
472 | bool PlayListWidget::last() { | 473 | bool PlayListWidget::last() { |
473 | if ( mediaPlayerState->playlist() ) | 474 | if ( mediaPlayerState->playlist() ) |
474 | return d->selectedFiles->last(); | 475 | return d->selectedFiles->last(); |
475 | else | 476 | else |
476 | return mediaPlayerState->looping(); | 477 | return mediaPlayerState->looping(); |
477 | } | 478 | } |
478 | 479 | ||
479 | 480 | ||
480 | void PlayListWidget::saveList() { | 481 | void PlayListWidget::saveList() { |
481 | writem3u(); | 482 | writem3u(); |
482 | } | 483 | } |
483 | 484 | ||
484 | 485 | ||
485 | void PlayListWidget::loadList( const DocLnk & lnk) { | 486 | void PlayListWidget::loadList( const DocLnk & lnk) { |
486 | QString name = lnk.name(); | 487 | QString name = lnk.name(); |
487 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); | 488 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); |
488 | 489 | ||
489 | if( name.length()>0) { | 490 | if( name.length()>0) { |
490 | setCaption("OpiePlayer: "+name); | 491 | setCaption("OpiePlayer: "+name); |
491 | qDebug("<<<<<<<<<<<<load list "+ lnk.file()); | 492 | qDebug("<<<<<<<<<<<<load list "+ lnk.file()); |
492 | clearList(); | 493 | clearList(); |
493 | readm3u(lnk.file()); | 494 | readm3u(lnk.file()); |
494 | tabWidget->setCurrentPage(0); | 495 | tabWidget->setCurrentPage(0); |
495 | } | 496 | } |
496 | } | 497 | } |
497 | 498 | ||
498 | 499 | ||
499 | void PlayListWidget::setPlaylist( bool shown ) { | 500 | void PlayListWidget::setPlaylist( bool shown ) { |
500 | if ( shown ) { | 501 | if ( shown ) { |
501 | d->playListFrame->show(); | 502 | d->playListFrame->show(); |
502 | } else { | 503 | } else { |
503 | d->playListFrame->hide(); | 504 | d->playListFrame->hide(); |
504 | } | 505 | } |
505 | } | 506 | } |
506 | 507 | ||
507 | 508 | ||
508 | void PlayListWidget::addSelected() { | 509 | void PlayListWidget::addSelected() { |
509 | 510 | ||
510 | switch (whichList()) { | 511 | switch (whichList()) { |
511 | case 0: //playlist | 512 | case 0: //playlist |
512 | break; | 513 | break; |
513 | case 1: { //audio | 514 | case 1: { //audio |
514 | QListViewItemIterator it( audioView ); | 515 | QListViewItemIterator it( audioView ); |
515 | // iterate through all items of the listview | 516 | // iterate through all items of the listview |
516 | for ( ; it.current(); ++it ) { | 517 | for ( ; it.current(); ++it ) { |
517 | if ( it.current()->isSelected() ) { | 518 | if ( it.current()->isSelected() ) { |
518 | QListIterator<DocLnk> dit( files.children() ); | 519 | QListIterator<DocLnk> dit( files.children() ); |
519 | for ( ; dit.current(); ++dit ) { | 520 | for ( ; dit.current(); ++dit ) { |
520 | if( dit.current()->name() == it.current()->text(0) ) { | 521 | if( dit.current()->name() == it.current()->text(0) ) { |
521 | if( QFileInfo( dit.current()->file()).exists()) { | 522 | if( QFileInfo( dit.current()->file()).exists()) { |
522 | d->selectedFiles->addToSelection( **dit ); | 523 | d->selectedFiles->addToSelection( **dit ); |
523 | audioView->setSelected( it.current(),FALSE); | 524 | audioView->setSelected( it.current(),FALSE); |
524 | } | 525 | } |
525 | } | 526 | } |
526 | } | 527 | } |
527 | } | 528 | } |
528 | } | 529 | } |
529 | tabWidget->setCurrentPage(0); | 530 | tabWidget->setCurrentPage(0); |
530 | writeCurrentM3u(); | 531 | writeCurrentM3u(); |
531 | } | 532 | } |
532 | break; | 533 | break; |
533 | case 2: { // video | 534 | case 2: { // video |
534 | QListViewItemIterator it( videoView ); | 535 | QListViewItemIterator it( videoView ); |
535 | // iterate through all items of the listview | 536 | // iterate through all items of the listview |