author | simon <simon> | 2002-12-02 17:10:14 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 17:10:14 (UTC) |
commit | e2e40368d1e98cfd3814e14a56c0e503d494cf4f (patch) (unidiff) | |
tree | 2dc59b9f4e5c5a8cd971934b1dd5976939bbac37 | |
parent | d86803bacac02ae99388cba069532851a5e08ce8 (diff) | |
download | opie-e2e40368d1e98cfd3814e14a56c0e503d494cf4f.zip opie-e2e40368d1e98cfd3814e14a56c0e503d494cf4f.tar.gz opie-e2e40368d1e98cfd3814e14a56c0e503d494cf4f.tar.bz2 |
- removed unused (and never initialized to something != 0)
PlayListWidgetPrivate::current
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 7 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidgetgui.cpp | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidgetgui.h | 1 |
3 files changed, 1 insertions, 8 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 55b66ab..6355bec 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -108,131 +108,128 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
108 | bool b= cfg.readBoolEntry("FullScreen", 0); | 108 | bool b= cfg.readBoolEntry("FullScreen", 0); |
109 | mediaPlayerState->setFullscreen( b ); | 109 | mediaPlayerState->setFullscreen( b ); |
110 | pmView->setItemChecked( -16, b ); | 110 | pmView->setItemChecked( -16, b ); |
111 | 111 | ||
112 | (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", | 112 | (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", |
113 | d->selectedFiles, SLOT(moveSelectedUp() ) ); | 113 | d->selectedFiles, SLOT(moveSelectedUp() ) ); |
114 | (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", | 114 | (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", |
115 | d->selectedFiles, SLOT(removeSelected() ) ); | 115 | d->selectedFiles, SLOT(removeSelected() ) ); |
116 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", | 116 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", |
117 | d->selectedFiles, SLOT(moveSelectedDown() ) ); | 117 | d->selectedFiles, SLOT(moveSelectedDown() ) ); |
118 | // QVBox *stretch2 = new QVBox( vbox1 ); | 118 | // QVBox *stretch2 = new QVBox( vbox1 ); |
119 | 119 | ||
120 | connect( tbDeletePlaylist, ( SIGNAL( released() ) ), | 120 | connect( tbDeletePlaylist, ( SIGNAL( released() ) ), |
121 | SLOT( deletePlaylist() ) ); | 121 | SLOT( deletePlaylist() ) ); |
122 | connect( pmView, SIGNAL( activated( int ) ), | 122 | connect( pmView, SIGNAL( activated( int ) ), |
123 | this, SLOT( pmViewActivated( int ) ) ); | 123 | this, SLOT( pmViewActivated( int ) ) ); |
124 | connect( skinsMenu, SIGNAL( activated( int ) ) , | 124 | connect( skinsMenu, SIGNAL( activated( int ) ) , |
125 | this, SLOT( skinsMenuActivated( int ) ) ); | 125 | this, SLOT( skinsMenuActivated( int ) ) ); |
126 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), | 126 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), |
127 | this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); | 127 | this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); |
128 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), | 128 | connect( audioView, 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( audioView, SIGNAL( returnPressed( QListViewItem *) ), | 130 | connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), |
131 | this,SLOT( playIt( QListViewItem *) ) ); | 131 | this,SLOT( playIt( QListViewItem *) ) ); |
132 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), | 132 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), |
133 | this, SLOT( addToSelection( QListViewItem *) ) ); | 133 | this, SLOT( addToSelection( QListViewItem *) ) ); |
134 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), | 134 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), |
135 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); | 135 | this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); |
136 | connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), | 136 | connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), |
137 | this,SLOT( playIt( QListViewItem *) ) ); | 137 | this,SLOT( playIt( QListViewItem *) ) ); |
138 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), | 138 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), |
139 | this, SLOT( addToSelection( QListViewItem *) ) ); | 139 | this, SLOT( addToSelection( QListViewItem *) ) ); |
140 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), | 140 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), |
141 | this, SLOT( loadList( const DocLnk & ) ) ); | 141 | this, SLOT( loadList( const DocLnk & ) ) ); |
142 | connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), | 142 | connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), |
143 | this, SLOT( tabChanged( QWidget* ) ) ); | 143 | this, SLOT( tabChanged( QWidget* ) ) ); |
144 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), | 144 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), |
145 | d->tbPlay, SLOT( setOn( bool ) ) ); | 145 | d->tbPlay, SLOT( setOn( bool ) ) ); |
146 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), | 146 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), |
147 | d->tbLoop, SLOT( setOn( bool ) ) ); | 147 | d->tbLoop, SLOT( setOn( bool ) ) ); |
148 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), | 148 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), |
149 | d->tbShuffle, SLOT( setOn( bool ) ) ); | 149 | d->tbShuffle, SLOT( setOn( bool ) ) ); |
150 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), | 150 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), |
151 | this, SLOT( setPlaylist( bool ) ) ); | 151 | this, SLOT( setPlaylist( bool ) ) ); |
152 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), | 152 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), |
153 | this, SLOT( playIt( QListViewItem *) ) ); | 153 | this, SLOT( playIt( QListViewItem *) ) ); |
154 | connect ( gammaSlider, SIGNAL( valueChanged( int ) ), | 154 | connect ( gammaSlider, SIGNAL( valueChanged( int ) ), |
155 | mediaPlayerState, SLOT( setVideoGamma( int ) ) ); | 155 | mediaPlayerState, SLOT( setVideoGamma( int ) ) ); |
156 | 156 | ||
157 | // see which skins are installed | 157 | // see which skins are installed |
158 | videoScan=false; | 158 | videoScan=false; |
159 | audioScan=false; | 159 | audioScan=false; |
160 | audioPopulated=false; | 160 | audioPopulated=false; |
161 | videoPopulated=false; | 161 | videoPopulated=false; |
162 | populateSkinsMenu(); | 162 | populateSkinsMenu(); |
163 | initializeStates(); | 163 | initializeStates(); |
164 | 164 | ||
165 | cfg.setGroup("PlayList"); | 165 | cfg.setGroup("PlayList"); |
166 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); | 166 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); |
167 | loadList(DocLnk( currentPlaylist ) ); | 167 | loadList(DocLnk( currentPlaylist ) ); |
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
171 | PlayListWidget::~PlayListWidget() { | 171 | PlayListWidget::~PlayListWidget() { |
172 | if ( d->current ) { | ||
173 | delete d->current; | ||
174 | } | ||
175 | delete d; | 172 | delete d; |
176 | } | 173 | } |
177 | 174 | ||
178 | 175 | ||
179 | void PlayListWidget::initializeStates() { | 176 | void PlayListWidget::initializeStates() { |
180 | d->tbPlay->setOn( mediaPlayerState->isPlaying() ); | 177 | d->tbPlay->setOn( mediaPlayerState->isPlaying() ); |
181 | d->tbLoop->setOn( mediaPlayerState->isLooping() ); | 178 | d->tbLoop->setOn( mediaPlayerState->isLooping() ); |
182 | d->tbShuffle->setOn( mediaPlayerState->isShuffled() ); | 179 | d->tbShuffle->setOn( mediaPlayerState->isShuffled() ); |
183 | setPlaylist( true ); | 180 | setPlaylist( true ); |
184 | } | 181 | } |
185 | 182 | ||
186 | void PlayListWidget::writeDefaultPlaylist() { | 183 | void PlayListWidget::writeDefaultPlaylist() { |
187 | 184 | ||
188 | Config config( "OpiePlayer" ); | 185 | Config config( "OpiePlayer" ); |
189 | config.setGroup( "PlayList" ); | 186 | config.setGroup( "PlayList" ); |
190 | QString filename=QPEApplication::documentDir() + "/default.m3u"; | 187 | QString filename=QPEApplication::documentDir() + "/default.m3u"; |
191 | QString currentString = config.readEntry( "CurrentPlaylist", filename); | 188 | QString currentString = config.readEntry( "CurrentPlaylist", filename); |
192 | if( currentString == filename) { | 189 | if( currentString == filename) { |
193 | Om3u *m3uList; | 190 | Om3u *m3uList; |
194 | // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); | 191 | // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); |
195 | if( d->selectedFiles->first() ) { | 192 | if( d->selectedFiles->first() ) { |
196 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); | 193 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); |
197 | do { | 194 | do { |
198 | // qDebug(d->selectedFiles->current()->file()); | 195 | // qDebug(d->selectedFiles->current()->file()); |
199 | m3uList->add( d->selectedFiles->current()->file() ); | 196 | m3uList->add( d->selectedFiles->current()->file() ); |
200 | } | 197 | } |
201 | while ( d->selectedFiles->next() ); | 198 | while ( d->selectedFiles->next() ); |
202 | 199 | ||
203 | m3uList->write(); | 200 | m3uList->write(); |
204 | m3uList->close(); | 201 | m3uList->close(); |
205 | if(m3uList) delete m3uList; | 202 | if(m3uList) delete m3uList; |
206 | 203 | ||
207 | } | 204 | } |
208 | } | 205 | } |
209 | } | 206 | } |
210 | 207 | ||
211 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 208 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
212 | d->setDocumentUsed = FALSE; | 209 | d->setDocumentUsed = FALSE; |
213 | if ( mediaPlayerState->isUsingPlaylist() ) { | 210 | if ( mediaPlayerState->isUsingPlaylist() ) { |
214 | if( QFileInfo( lnk.file() ).exists() || | 211 | if( QFileInfo( lnk.file() ).exists() || |
215 | lnk.file().left(4) == "http" ) { | 212 | lnk.file().left(4) == "http" ) { |
216 | d->selectedFiles->addToSelection( lnk ); | 213 | d->selectedFiles->addToSelection( lnk ); |
217 | } | 214 | } |
218 | // writeCurrentM3u(); | 215 | // writeCurrentM3u(); |
219 | } | 216 | } |
220 | else | 217 | else |
221 | mediaPlayerState->setPlaying( TRUE ); | 218 | mediaPlayerState->setPlaying( TRUE ); |
222 | } | 219 | } |
223 | 220 | ||
224 | 221 | ||
225 | void PlayListWidget::clearList() { | 222 | void PlayListWidget::clearList() { |
226 | while ( first() ) { | 223 | while ( first() ) { |
227 | d->selectedFiles->removeSelected(); | 224 | d->selectedFiles->removeSelected(); |
228 | } | 225 | } |
229 | } | 226 | } |
230 | 227 | ||
231 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { | 228 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { |
232 | switch (mouse) { | 229 | switch (mouse) { |
233 | case 1: | 230 | case 1: |
234 | break; | 231 | break; |
235 | case 2: | 232 | case 2: |
236 | { | 233 | { |
237 | QPopupMenu m; | 234 | QPopupMenu m; |
238 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | 235 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); |
@@ -367,132 +364,130 @@ void PlayListWidget::addAllVideoToList() { | |||
367 | DocLnk lnk; | 364 | DocLnk lnk; |
368 | QString filename; | 365 | QString filename; |
369 | for ( ; videoIt.current(); ++videoIt ) { | 366 | for ( ; videoIt.current(); ++videoIt ) { |
370 | filename = videoIt.current()->text(3); | 367 | filename = videoIt.current()->text(3); |
371 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 368 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
372 | lnk.setFile( filename ); //sets file name | 369 | lnk.setFile( filename ); //sets file name |
373 | d->selectedFiles->addToSelection( lnk); | 370 | d->selectedFiles->addToSelection( lnk); |
374 | } | 371 | } |
375 | 372 | ||
376 | 373 | ||
377 | /* if(!videoScan) | 374 | /* if(!videoScan) |
378 | scanForVideo(); | 375 | scanForVideo(); |
379 | QListIterator<DocLnk> dit( vFiles.children() ); | 376 | QListIterator<DocLnk> dit( vFiles.children() ); |
380 | for ( ; dit.current(); ++dit ) { | 377 | for ( ; dit.current(); ++dit ) { |
381 | if( QFileInfo( dit.current()->file() ).exists() ) { | 378 | if( QFileInfo( dit.current()->file() ).exists() ) { |
382 | d->selectedFiles->addToSelection( **dit ); | 379 | d->selectedFiles->addToSelection( **dit ); |
383 | } | 380 | } |
384 | } | 381 | } |
385 | */ | 382 | */ |
386 | tabWidget->setCurrentPage(0); | 383 | tabWidget->setCurrentPage(0); |
387 | writeCurrentM3u(); | 384 | writeCurrentM3u(); |
388 | d->selectedFiles->first(); | 385 | d->selectedFiles->first(); |
389 | } | 386 | } |
390 | 387 | ||
391 | 388 | ||
392 | void PlayListWidget::setDocument( const QString& fileref ) { | 389 | void PlayListWidget::setDocument( const QString& fileref ) { |
393 | // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); | 390 | // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); |
394 | fromSetDocument = TRUE; | 391 | fromSetDocument = TRUE; |
395 | if ( fileref.isNull() ) { | 392 | if ( fileref.isNull() ) { |
396 | QMessageBox::warning( this, tr( "Invalid File" ), | 393 | QMessageBox::warning( this, tr( "Invalid File" ), |
397 | tr( "There was a problem in getting the file." ) ); | 394 | tr( "There was a problem in getting the file." ) ); |
398 | return; | 395 | return; |
399 | } | 396 | } |
400 | 397 | ||
401 | clearList(); | 398 | clearList(); |
402 | if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u | 399 | if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u |
403 | readm3u( fileref ); | 400 | readm3u( fileref ); |
404 | } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { | 401 | } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { |
405 | readm3u( DocLnk( fileref).file() ); | 402 | readm3u( DocLnk( fileref).file() ); |
406 | } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls | 403 | } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls |
407 | readPls( fileref ); | 404 | readPls( fileref ); |
408 | } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { | 405 | } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { |
409 | readPls( DocLnk( fileref).file() ); | 406 | readPls( DocLnk( fileref).file() ); |
410 | } else { | 407 | } else { |
411 | clearList(); | 408 | clearList(); |
412 | addToSelection( DocLnk( fileref ) ); | 409 | addToSelection( DocLnk( fileref ) ); |
413 | writeCurrentM3u(); | 410 | writeCurrentM3u(); |
414 | 411 | ||
415 | d->setDocumentUsed = TRUE; | 412 | d->setDocumentUsed = TRUE; |
416 | mediaPlayerState->setPlaying( FALSE ); | 413 | mediaPlayerState->setPlaying( FALSE ); |
417 | mediaPlayerState->setPlaying( TRUE ); | 414 | mediaPlayerState->setPlaying( TRUE ); |
418 | } | 415 | } |
419 | } | 416 | } |
420 | 417 | ||
421 | 418 | ||
422 | void PlayListWidget::useSelectedDocument() { | 419 | void PlayListWidget::useSelectedDocument() { |
423 | d->setDocumentUsed = FALSE; | 420 | d->setDocumentUsed = FALSE; |
424 | } | 421 | } |
425 | 422 | ||
426 | 423 | ||
427 | const DocLnk *PlayListWidget::current() const { // this is fugly | 424 | const DocLnk *PlayListWidget::current() const { // this is fugly |
428 | assert( currentTab() == CurrentPlayList ); | 425 | assert( currentTab() == CurrentPlayList ); |
429 | 426 | ||
430 | // qDebug("playlist"); | 427 | // qDebug("playlist"); |
431 | if ( mediaPlayerState->isUsingPlaylist() ) { | 428 | if ( mediaPlayerState->isUsingPlaylist() ) |
432 | return d->selectedFiles->current(); | 429 | return d->selectedFiles->current(); |
433 | } else if ( d->setDocumentUsed && d->current ) | ||
434 | return d->current; | ||
435 | 430 | ||
436 | assert( false ); | 431 | assert( false ); |
437 | } | 432 | } |
438 | 433 | ||
439 | 434 | ||
440 | bool PlayListWidget::prev() { | 435 | bool PlayListWidget::prev() { |
441 | if ( mediaPlayerState->isUsingPlaylist() ) { | 436 | if ( mediaPlayerState->isUsingPlaylist() ) { |
442 | if ( mediaPlayerState->isShuffled() ) { | 437 | if ( mediaPlayerState->isShuffled() ) { |
443 | const DocLnk *cur = current(); | 438 | const DocLnk *cur = current(); |
444 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); | 439 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); |
445 | for ( int i = 0; i < j; i++ ) { | 440 | for ( int i = 0; i < j; i++ ) { |
446 | if ( !d->selectedFiles->next() ) | 441 | if ( !d->selectedFiles->next() ) |
447 | d->selectedFiles->first(); | 442 | d->selectedFiles->first(); |
448 | } | 443 | } |
449 | if ( cur == current() ) | 444 | if ( cur == current() ) |
450 | if ( !d->selectedFiles->next() ) { | 445 | if ( !d->selectedFiles->next() ) { |
451 | d->selectedFiles->first(); | 446 | d->selectedFiles->first(); |
452 | } | 447 | } |
453 | return TRUE; | 448 | return TRUE; |
454 | } else { | 449 | } else { |
455 | if ( !d->selectedFiles->prev() ) { | 450 | if ( !d->selectedFiles->prev() ) { |
456 | if ( mediaPlayerState->isLooping() ) { | 451 | if ( mediaPlayerState->isLooping() ) { |
457 | return d->selectedFiles->last(); | 452 | return d->selectedFiles->last(); |
458 | } else { | 453 | } else { |
459 | return FALSE; | 454 | return FALSE; |
460 | } | 455 | } |
461 | } | 456 | } |
462 | return TRUE; | 457 | return TRUE; |
463 | } | 458 | } |
464 | } else { | 459 | } else { |
465 | return mediaPlayerState->isLooping(); | 460 | return mediaPlayerState->isLooping(); |
466 | } | 461 | } |
467 | } | 462 | } |
468 | 463 | ||
469 | 464 | ||
470 | bool PlayListWidget::next() { | 465 | bool PlayListWidget::next() { |
471 | //qDebug("<<<<<<<<<<<<next()"); | 466 | //qDebug("<<<<<<<<<<<<next()"); |
472 | if ( mediaPlayerState->isUsingPlaylist() ) { | 467 | if ( mediaPlayerState->isUsingPlaylist() ) { |
473 | if ( mediaPlayerState->isShuffled() ) { | 468 | if ( mediaPlayerState->isShuffled() ) { |
474 | return prev(); | 469 | return prev(); |
475 | } else { | 470 | } else { |
476 | if ( !d->selectedFiles->next() ) { | 471 | if ( !d->selectedFiles->next() ) { |
477 | if ( mediaPlayerState->isLooping() ) { | 472 | if ( mediaPlayerState->isLooping() ) { |
478 | return d->selectedFiles->first(); | 473 | return d->selectedFiles->first(); |
479 | } else { | 474 | } else { |
480 | return FALSE; | 475 | return FALSE; |
481 | } | 476 | } |
482 | } | 477 | } |
483 | return TRUE; | 478 | return TRUE; |
484 | } | 479 | } |
485 | } else { | 480 | } else { |
486 | return mediaPlayerState->isLooping(); | 481 | return mediaPlayerState->isLooping(); |
487 | } | 482 | } |
488 | } | 483 | } |
489 | 484 | ||
490 | 485 | ||
491 | bool PlayListWidget::first() { | 486 | bool PlayListWidget::first() { |
492 | if ( mediaPlayerState->isUsingPlaylist() ) | 487 | if ( mediaPlayerState->isUsingPlaylist() ) |
493 | return d->selectedFiles->first(); | 488 | return d->selectedFiles->first(); |
494 | else | 489 | else |
495 | return mediaPlayerState->isLooping(); | 490 | return mediaPlayerState->isLooping(); |
496 | } | 491 | } |
497 | 492 | ||
498 | 493 | ||
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp index a217c94..db7c979 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp | |||
@@ -5,129 +5,128 @@ | |||
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; General Public License for more | 22 | ..}^=.= = ; General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <qpe/qpemenubar.h> | 34 | #include <qpe/qpemenubar.h> |
35 | #include <qpe/qpetoolbar.h> | 35 | #include <qpe/qpetoolbar.h> |
36 | #include <qpe/fileselector.h> | 36 | #include <qpe/fileselector.h> |
37 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
38 | #include <qpe/storage.h> | 38 | #include <qpe/storage.h> |
39 | #include <qpe/mimetype.h> | 39 | #include <qpe/mimetype.h> |
40 | #include <qpe/config.h> | 40 | #include <qpe/config.h> |
41 | #include <qpe/global.h> | 41 | #include <qpe/global.h> |
42 | #include <qpe/resource.h> | 42 | #include <qpe/resource.h> |
43 | 43 | ||
44 | #include <qpopupmenu.h> | 44 | #include <qpopupmenu.h> |
45 | #include <qaction.h> | 45 | #include <qaction.h> |
46 | #include <qcursor.h> | 46 | #include <qcursor.h> |
47 | #include <qdir.h> | 47 | #include <qdir.h> |
48 | #include <qlayout.h> | 48 | #include <qlayout.h> |
49 | 49 | ||
50 | #include "playlistselection.h" | 50 | #include "playlistselection.h" |
51 | #include "playlistwidget.h" | 51 | #include "playlistwidget.h" |
52 | #include "mediaplayerstate.h" | 52 | #include "mediaplayerstate.h" |
53 | #include "inputDialog.h" | 53 | #include "inputDialog.h" |
54 | 54 | ||
55 | //only needed for the random play | 55 | //only needed for the random play |
56 | #include <stdlib.h> | 56 | #include <stdlib.h> |
57 | 57 | ||
58 | #include "audiowidget.h" | 58 | #include "audiowidget.h" |
59 | #include "videowidget.h" | 59 | #include "videowidget.h" |
60 | #include "mediaplayerstate.h" | 60 | #include "mediaplayerstate.h" |
61 | 61 | ||
62 | extern MediaPlayerState *mediaPlayerState; | 62 | extern MediaPlayerState *mediaPlayerState; |
63 | 63 | ||
64 | PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags fl ) | 64 | PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags fl ) |
65 | : QMainWindow( parent, name, fl ) { | 65 | : QMainWindow( parent, name, fl ) { |
66 | 66 | ||
67 | d = new PlayListWidgetPrivate; | 67 | d = new PlayListWidgetPrivate; |
68 | d->setDocumentUsed = FALSE; | 68 | d->setDocumentUsed = FALSE; |
69 | d->current = NULL; | ||
70 | 69 | ||
71 | setBackgroundMode( PaletteButton ); | 70 | setBackgroundMode( PaletteButton ); |
72 | setToolBarsMovable( FALSE ); | 71 | setToolBarsMovable( FALSE ); |
73 | 72 | ||
74 | // Create Toolbar | 73 | // Create Toolbar |
75 | QPEToolBar *toolbar = new QPEToolBar( this ); | 74 | QPEToolBar *toolbar = new QPEToolBar( this ); |
76 | toolbar->setHorizontalStretchable( TRUE ); | 75 | toolbar->setHorizontalStretchable( TRUE ); |
77 | 76 | ||
78 | // Create Menubar | 77 | // Create Menubar |
79 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); | 78 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); |
80 | menu->setMargin( 0 ); | 79 | menu->setMargin( 0 ); |
81 | 80 | ||
82 | bar = new QPEToolBar( this ); | 81 | bar = new QPEToolBar( this ); |
83 | bar->setLabel( tr( "Play Operations" ) ); | 82 | bar->setLabel( tr( "Play Operations" ) ); |
84 | 83 | ||
85 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" ); | 84 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" ); |
86 | tbDeletePlaylist->setFlat( TRUE ); | 85 | tbDeletePlaylist->setFlat( TRUE ); |
87 | tbDeletePlaylist->setFixedSize( 20, 20 ); | 86 | tbDeletePlaylist->setFixedSize( 20, 20 ); |
88 | 87 | ||
89 | tbDeletePlaylist->hide(); | 88 | tbDeletePlaylist->hide(); |
90 | 89 | ||
91 | pmPlayList = new QPopupMenu( this ); | 90 | pmPlayList = new QPopupMenu( this ); |
92 | menu->insertItem( tr( "File" ), pmPlayList ); | 91 | menu->insertItem( tr( "File" ), pmPlayList ); |
93 | 92 | ||
94 | pmView = new QPopupMenu( this ); | 93 | pmView = new QPopupMenu( this ); |
95 | menu->insertItem( tr( "View" ), pmView ); | 94 | menu->insertItem( tr( "View" ), pmView ); |
96 | pmView->isCheckable(); | 95 | pmView->isCheckable(); |
97 | 96 | ||
98 | skinsMenu = new QPopupMenu( this ); | 97 | skinsMenu = new QPopupMenu( this ); |
99 | pmView->insertItem( tr( "Skins" ), skinsMenu ); | 98 | pmView->insertItem( tr( "Skins" ), skinsMenu ); |
100 | skinsMenu->isCheckable(); | 99 | skinsMenu->isCheckable(); |
101 | 100 | ||
102 | gammaMenu = new QPopupMenu( this ); | 101 | gammaMenu = new QPopupMenu( this ); |
103 | pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu ); | 102 | pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu ); |
104 | 103 | ||
105 | gammaSlider = new QSlider( QSlider::Vertical, gammaMenu ); | 104 | gammaSlider = new QSlider( QSlider::Vertical, gammaMenu ); |
106 | gammaSlider->setRange( -40, 40 ); | 105 | gammaSlider->setRange( -40, 40 ); |
107 | gammaSlider->setTickmarks( QSlider::Left ); | 106 | gammaSlider->setTickmarks( QSlider::Left ); |
108 | gammaSlider->setTickInterval( 20 ); | 107 | gammaSlider->setTickInterval( 20 ); |
109 | gammaSlider->setFocusPolicy( QWidget::StrongFocus ); | 108 | gammaSlider->setFocusPolicy( QWidget::StrongFocus ); |
110 | gammaSlider->setValue( 0 ); | 109 | gammaSlider->setValue( 0 ); |
111 | gammaSlider->setMinimumHeight( 50 ); | 110 | gammaSlider->setMinimumHeight( 50 ); |
112 | 111 | ||
113 | gammaLCD = new QLCDNumber( 3, gammaMenu ); | 112 | gammaLCD = new QLCDNumber( 3, gammaMenu ); |
114 | gammaLCD-> setFrameShape ( QFrame::NoFrame ); | 113 | gammaLCD-> setFrameShape ( QFrame::NoFrame ); |
115 | gammaLCD-> setSegmentStyle ( QLCDNumber::Flat ); | 114 | gammaLCD-> setSegmentStyle ( QLCDNumber::Flat ); |
116 | 115 | ||
117 | gammaMenu->insertItem( gammaSlider ); | 116 | gammaMenu->insertItem( gammaSlider ); |
118 | gammaMenu->insertItem( gammaLCD ); | 117 | gammaMenu->insertItem( gammaLCD ); |
119 | 118 | ||
120 | connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) ); | 119 | connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) ); |
121 | 120 | ||
122 | vbox5 = new QVBox( this ); | 121 | vbox5 = new QVBox( this ); |
123 | QVBox *vbox4 = new QVBox( vbox5 ); | 122 | QVBox *vbox4 = new QVBox( vbox5 ); |
124 | QHBox *hbox6 = new QHBox( vbox4 ); | 123 | QHBox *hbox6 = new QHBox( vbox4 ); |
125 | 124 | ||
126 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 125 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
127 | 126 | ||
128 | QWidget *pTab; | 127 | QWidget *pTab; |
129 | pTab = new QWidget( tabWidget, "pTab" ); | 128 | pTab = new QWidget( tabWidget, "pTab" ); |
130 | tabWidget->insertTab( pTab, "Playlist"); | 129 | tabWidget->insertTab( pTab, "Playlist"); |
131 | 130 | ||
132 | QGridLayout *Playout = new QGridLayout( pTab ); | 131 | QGridLayout *Playout = new QGridLayout( pTab ); |
133 | Playout->setSpacing( 2); | 132 | Playout->setSpacing( 2); |
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.h b/noncore/multimedia/opieplayer2/playlistwidgetgui.h index 6c35771..4eefb93 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.h +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.h | |||
@@ -3,127 +3,126 @@ | |||
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; General Public License for more | 22 | ..}^=.= = ; General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef PLAY_LIST_WIDGET_GUI_H | 34 | #ifndef PLAY_LIST_WIDGET_GUI_H |
35 | #define PLAY_LIST_WIDGET_GUI_H | 35 | #define PLAY_LIST_WIDGET_GUI_H |
36 | 36 | ||
37 | #include <qmainwindow.h> | 37 | #include <qmainwindow.h> |
38 | #include <qpe/applnk.h> | 38 | #include <qpe/applnk.h> |
39 | #include <qpe/resource.h> | 39 | #include <qpe/resource.h> |
40 | #include <qpe/qpemenubar.h> | 40 | #include <qpe/qpemenubar.h> |
41 | 41 | ||
42 | #include <qtabwidget.h> | 42 | #include <qtabwidget.h> |
43 | #include <qpe/fileselector.h> | 43 | #include <qpe/fileselector.h> |
44 | #include <qpushbutton.h> | 44 | #include <qpushbutton.h> |
45 | #include <qpopupmenu.h> | 45 | #include <qpopupmenu.h> |
46 | #include <qaction.h> | 46 | #include <qaction.h> |
47 | #include <qslider.h> | 47 | #include <qslider.h> |
48 | #include <qlcdnumber.h> | 48 | #include <qlcdnumber.h> |
49 | 49 | ||
50 | class PlayListWidgetPrivate; | 50 | class PlayListWidgetPrivate; |
51 | class PlayListSelection; | 51 | class PlayListSelection; |
52 | 52 | ||
53 | class Config; | 53 | class Config; |
54 | class QPEToolBar; | 54 | class QPEToolBar; |
55 | class QListViewItem; | 55 | class QListViewItem; |
56 | class QListView; | 56 | class QListView; |
57 | class QPoint; | 57 | class QPoint; |
58 | class QAction; | 58 | class QAction; |
59 | class QLabel; | 59 | class QLabel; |
60 | 60 | ||
61 | class PlayListWidgetPrivate { | 61 | class PlayListWidgetPrivate { |
62 | public: | 62 | public: |
63 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; | 63 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; |
64 | QFrame *playListFrame; | 64 | QFrame *playListFrame; |
65 | PlayListSelection *selectedFiles; | 65 | PlayListSelection *selectedFiles; |
66 | bool setDocumentUsed; | 66 | bool setDocumentUsed; |
67 | DocLnk *current; | ||
68 | }; | 67 | }; |
69 | 68 | ||
70 | 69 | ||
71 | class ToolButton : public QToolButton { | 70 | class ToolButton : public QToolButton { |
72 | public: | 71 | public: |
73 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 72 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
74 | : QToolButton( parent, name ) { | 73 | : QToolButton( parent, name ) { |
75 | setTextLabel( name ); | 74 | setTextLabel( name ); |
76 | setPixmap( Resource::loadPixmap( icon ) ); | 75 | setPixmap( Resource::loadPixmap( icon ) ); |
77 | setAutoRaise( TRUE ); | 76 | setAutoRaise( TRUE ); |
78 | setFocusPolicy( QWidget::NoFocus ); | 77 | setFocusPolicy( QWidget::NoFocus ); |
79 | setToggleButton( t ); | 78 | setToggleButton( t ); |
80 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 79 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
81 | QPEMenuToolFocusManager::manager()->addWidget( this ); | 80 | QPEMenuToolFocusManager::manager()->addWidget( this ); |
82 | } | 81 | } |
83 | }; | 82 | }; |
84 | 83 | ||
85 | 84 | ||
86 | class MenuItem : public QAction { | 85 | class MenuItem : public QAction { |
87 | 86 | ||
88 | public: | 87 | public: |
89 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) | 88 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) |
90 | : QAction( text, QString::null, 0, 0 ) { | 89 | : QAction( text, QString::null, 0, 0 ) { |
91 | connect( this, SIGNAL( activated() ), handler, slot ); | 90 | connect( this, SIGNAL( activated() ), handler, slot ); |
92 | addTo( parent ); | 91 | addTo( parent ); |
93 | } | 92 | } |
94 | }; | 93 | }; |
95 | 94 | ||
96 | class PlayListWidgetGui : public QMainWindow { | 95 | class PlayListWidgetGui : public QMainWindow { |
97 | Q_OBJECT | 96 | Q_OBJECT |
98 | public: | 97 | public: |
99 | PlayListWidgetGui( QWidget* parent=0, const char* name=0, WFlags fl=0 ); | 98 | PlayListWidgetGui( QWidget* parent=0, const char* name=0, WFlags fl=0 ); |
100 | ~PlayListWidgetGui(); | 99 | ~PlayListWidgetGui(); |
101 | 100 | ||
102 | protected: | 101 | protected: |
103 | QTabWidget * tabWidget; | 102 | QTabWidget * tabWidget; |
104 | QListView *audioView, *videoView, *playlistView; | 103 | QListView *audioView, *videoView, *playlistView; |
105 | QLabel *libString; | 104 | QLabel *libString; |
106 | QPopupMenu *pmView ; | 105 | QPopupMenu *pmView ; |
107 | QPopupMenu *gammaMenu; | 106 | QPopupMenu *gammaMenu; |
108 | QSlider *gammaSlider; | 107 | QSlider *gammaSlider; |
109 | QLCDNumber *gammaLCD; | 108 | QLCDNumber *gammaLCD; |
110 | bool fromSetDocument; | 109 | bool fromSetDocument; |
111 | bool insanityBool; | 110 | bool insanityBool; |
112 | QString setDocFileRef; | 111 | QString setDocFileRef; |
113 | // retrieve the current playlist entry (media file link) | 112 | // retrieve the current playlist entry (media file link) |
114 | QPushButton *tbDeletePlaylist; | 113 | QPushButton *tbDeletePlaylist; |
115 | int selected; | 114 | int selected; |
116 | QPopupMenu *pmPlayList; | 115 | QPopupMenu *pmPlayList; |
117 | FileSelector* playLists; | 116 | FileSelector* playLists; |
118 | QPopupMenu *skinsMenu; | 117 | QPopupMenu *skinsMenu; |
119 | PlayListWidgetPrivate *d; // Private implementation data | 118 | PlayListWidgetPrivate *d; // Private implementation data |
120 | QVBox *vbox1; | 119 | QVBox *vbox1; |
121 | QVBox *vbox5; | 120 | QVBox *vbox5; |
122 | QPEToolBar *bar; | 121 | QPEToolBar *bar; |
123 | void setActiveWindow(); // need to handle this to show the right view | 122 | void setActiveWindow(); // need to handle this to show the right view |
124 | void setView( char ); | 123 | void setView( char ); |
125 | 124 | ||
126 | }; | 125 | }; |
127 | 126 | ||
128 | #endif | 127 | #endif |
129 | 128 | ||