summaryrefslogtreecommitdiff
path: root/noncore/multimedia
authorsimon <simon>2002-12-02 17:42:44 (UTC)
committer simon <simon>2002-12-02 17:42:44 (UTC)
commitc31f9b59dba873739494fcd9916c7cb9120ce1d9 (patch) (unidiff)
tree4b3371edaf5f0f6f6240a7bfe8f16be1dc111e8d /noncore/multimedia
parent2f2f6cfbc31e0144060588b26814301ce99ebd39 (diff)
downloadopie-c31f9b59dba873739494fcd9916c7cb9120ce1d9.zip
opie-c31f9b59dba873739494fcd9916c7cb9120ce1d9.tar.gz
opie-c31f9b59dba873739494fcd9916c7cb9120ce1d9.tar.bz2
- don't enable the play button if switching to the playlist tab and the
playlist is empty - don't crash when starting to play and no item is selected in the playlist. instead select the first item then.
Diffstat (limited to 'noncore/multimedia') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistselection.h2
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp10
2 files changed, 11 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistselection.h b/noncore/multimedia/opieplayer2/playlistselection.h
index d10bc82..9cc4e30 100644
--- a/noncore/multimedia/opieplayer2/playlistselection.h
+++ b/noncore/multimedia/opieplayer2/playlistselection.h
@@ -42,12 +42,14 @@ public slots:
42 void setSelectedItem( const QString & ); 42 void setSelectedItem( const QString & );
43 bool prev(); 43 bool prev();
44 bool next(); 44 bool next();
45 bool first(); 45 bool first();
46 bool last(); 46 bool last();
47 47
48 bool isEmpty() const { return childCount() == 0; }
49
48protected: 50protected:
49 virtual void contentsMouseMoveEvent(QMouseEvent *); 51 virtual void contentsMouseMoveEvent(QMouseEvent *);
50/* #ifdef USE_PLAYLIST_BACKGROUND */ 52/* #ifdef USE_PLAYLIST_BACKGROUND */
51 virtual void drawBackground( QPainter *p, const QRect &r ); 53 virtual void drawBackground( QPainter *p, const QRect &r );
52 virtual void paintEmptyArea( QPainter *p, const QRect &r ) { drawBackground( p, r ); }; 54 virtual void paintEmptyArea( QPainter *p, const QRect &r ) { drawBackground( p, r ); };
53/* #endif */ 55/* #endif */
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index f53def6..b08204e 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -415,13 +415,19 @@ void PlayListWidget::useSelectedDocument() {
415} 415}
416 416
417 417
418const DocLnk *PlayListWidget::current() const { // this is fugly 418const DocLnk *PlayListWidget::current() const { // this is fugly
419 assert( currentTab() == CurrentPlayList ); 419 assert( currentTab() == CurrentPlayList );
420 420
421 return d->selectedFiles->current(); 421 const DocLnk *lnk = d->selectedFiles->current();
422 if ( !lnk ) {
423 d->selectedFiles->first();
424 lnk = d->selectedFiles->current();
425 }
426 assert( lnk );
427 return lnk;
422} 428}
423 429
424 430
425bool PlayListWidget::prev() { 431bool PlayListWidget::prev() {
426 if ( mediaPlayerState->isShuffled() ) { 432 if ( mediaPlayerState->isShuffled() ) {
427 const DocLnk *cur = current(); 433 const DocLnk *cur = current();
@@ -561,12 +567,14 @@ void PlayListWidget::tabChanged(QWidget *) {
561 { 567 {
562 if( !tbDeletePlaylist->isHidden() ) { 568 if( !tbDeletePlaylist->isHidden() ) {
563 tbDeletePlaylist->hide(); 569 tbDeletePlaylist->hide();
564 } 570 }
565 d->tbRemoveFromList->setEnabled(TRUE); 571 d->tbRemoveFromList->setEnabled(TRUE);
566 d->tbAddToList->setEnabled(FALSE); 572 d->tbAddToList->setEnabled(FALSE);
573
574 d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() );
567 } 575 }
568 break; 576 break;
569 case AudioFiles: 577 case AudioFiles:
570 { 578 {
571 // audioView->clear(); 579 // audioView->clear();
572 if(!audioPopulated) populateAudioView(); 580 if(!audioPopulated) populateAudioView();