summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp34
1 files changed, 14 insertions, 20 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 11a7b5c..a708cf6 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -416,39 +416,34 @@ void PlayListWidget::setDocument( const QString& fileref ) {
mediaPlayerState->setPlaying( FALSE );
mediaPlayerState->setPlaying( TRUE );
}
}
void PlayListWidget::useSelectedDocument() {
d->setDocumentUsed = FALSE;
}
const DocLnk *PlayListWidget::current() { // this is fugly
- switch ( whichList() ) {
- case 0: //playlist
- {
+ assert( currentTab() == CurrentPlayList );
+
// qDebug("playlist");
- if ( mediaPlayerState->isUsingPlaylist() ) {
- return d->selectedFiles->current();
- } else if ( d->setDocumentUsed && d->current ) {
- return d->current;
- } else {
- return &(d->files->selectedDocument());
- }
- }
- break;
- };
- return 0;
+ if ( mediaPlayerState->isUsingPlaylist() ) {
+ return d->selectedFiles->current();
+ } else if ( d->setDocumentUsed && d->current ) {
+ return d->current;
+ } else {
+ return &(d->files->selectedDocument());
+ }
}
bool PlayListWidget::prev() {
if ( mediaPlayerState->isUsingPlaylist() ) {
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();
}
@@ -1149,22 +1144,21 @@ int PlayListWidget::whichList() const {
PlayListWidget::TabType PlayListWidget::currentTab() const
{
static const TabType indexToTabType[ NumTabTypes ] =
{ CurrentPlayList, AudioFiles, VideoFiles, PlayLists };
int index = tabWidget->currentPageIndex();
assert( index < NumTabTypes && index >= 0 );
return indexToTabType[ index ];
}
QString PlayListWidget::currentFileListPathName() const {
- switch (whichList()) {
- case 1:
+ switch (currentTab()) {
+ case AudioFiles:
return audioView->currentItem()->text(3);
- break;
- case 2:
+ case VideoFiles:
return videoView->currentItem()->text(3);
- break;
+ default: assert( false );
};
- return "";
+ return QString::null;
}