summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (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
@@ -36,24 +36,26 @@ public slots:
void addToSelection( const DocLnk & ); // Add a media file to the playlist
void removeSelected(); // Remove a media file from the playlist
void moveSelectedUp(); // Move the media file up the playlist so it is played earlier
void moveSelectedDown(); // Move the media file down the playlist so it is played later
void unSelect();
void writeCurrent( Config &);
void setSelectedItem( const QString & );
bool prev();
bool next();
bool first();
bool last();
+ bool isEmpty() const { return childCount() == 0; }
+
protected:
virtual void contentsMouseMoveEvent(QMouseEvent *);
/* #ifdef USE_PLAYLIST_BACKGROUND */
virtual void drawBackground( QPainter *p, const QRect &r );
virtual void paintEmptyArea( QPainter *p, const QRect &r ) { drawBackground( p, r ); };
/* #endif */
private:
QList<DocLnk> selectedList;
const DocLnk *lnk;
};
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
@@ -409,25 +409,31 @@ void PlayListWidget::setDocument( const QString& fileref ) {
}
}
void PlayListWidget::useSelectedDocument() {
d->setDocumentUsed = FALSE;
}
const DocLnk *PlayListWidget::current() const { // this is fugly
assert( currentTab() == CurrentPlayList );
- return d->selectedFiles->current();
+ const DocLnk *lnk = d->selectedFiles->current();
+ if ( !lnk ) {
+ d->selectedFiles->first();
+ lnk = d->selectedFiles->current();
+ }
+ assert( lnk );
+ return lnk;
}
bool PlayListWidget::prev() {
if ( mediaPlayerState->isShuffled() ) {
const DocLnk *cur = current();
int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
for ( int i = 0; i < j; i++ ) {
if ( !d->selectedFiles->next() )
d->selectedFiles->first();
}
if ( cur == current() )
@@ -555,24 +561,26 @@ void PlayListWidget::addToSelection( QListViewItem *it) {
void PlayListWidget::tabChanged(QWidget *) {
d->tbPlay->setEnabled( true );
switch ( currentTab() ) {
case CurrentPlayList:
{
if( !tbDeletePlaylist->isHidden() ) {
tbDeletePlaylist->hide();
}
d->tbRemoveFromList->setEnabled(TRUE);
d->tbAddToList->setEnabled(FALSE);
+
+ d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() );
}
break;
case AudioFiles:
{
// audioView->clear();
if(!audioPopulated) populateAudioView();
if( !tbDeletePlaylist->isHidden() ) {
tbDeletePlaylist->hide();
}
d->tbRemoveFromList->setEnabled(FALSE);
d->tbAddToList->setEnabled(TRUE);