summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-02 17:27:32 (UTC)
committer simon <simon>2002-12-02 17:27:32 (UTC)
commit2f2f6cfbc31e0144060588b26814301ce99ebd39 (patch) (side-by-side diff)
tree9ca13234ce515afc57b2a11b5b4f9c2144a6b038
parent28f9d0587b2ee6a6a9467f658567a45ab7e95b94 (diff)
downloadopie-2f2f6cfbc31e0144060588b26814301ce99ebd39.zip
opie-2f2f6cfbc31e0144060588b26814301ce99ebd39.tar.gz
opie-2f2f6cfbc31e0144060588b26814301ce99ebd39.tar.bz2
- as MediaPlayerState::isUsingPlaylist() always returns true we can remove
it and simplify some code in the playlistwidget due to that
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h1
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp92
3 files changed, 35 insertions, 61 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index 43040c2..586870c 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -53,51 +53,48 @@ MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
readConfig( cfg );
streaming = false;
seekable = true;
}
MediaPlayerState::~MediaPlayerState() {
}
void MediaPlayerState::readConfig( Config& cfg ) {
cfg.setGroup("Options");
fullscreen = cfg.readBoolEntry( "FullScreen" );
scaled = cfg.readBoolEntry( "Scaling" );
looping = cfg.readBoolEntry( "Looping" );
shuffled = cfg.readBoolEntry( "Shuffle" );
- usePlaylist = cfg.readBoolEntry( "UsePlayList" );
videoGamma = cfg.readNumEntry( "VideoGamma" );
- usePlaylist = TRUE;
playing = FALSE;
streaming = FALSE;
paused = FALSE;
curPosition = 0;
curLength = 0;
curView = 'l';
}
void MediaPlayerState::writeConfig( Config& cfg ) const {
cfg.setGroup( "Options" );
cfg.writeEntry( "FullScreen", fullscreen );
cfg.writeEntry( "Scaling", scaled );
cfg.writeEntry( "Looping", looping );
cfg.writeEntry( "Shuffle", shuffled );
- cfg.writeEntry( "UsePlayList", usePlaylist );
cfg.writeEntry( "VideoGamma", videoGamma );
}
// slots
void MediaPlayerState::setIsStreaming( bool b ) {
streaming = b;
}
void MediaPlayerState::setIsSeekable( bool b ) {
seekable = b;
emit isSeekableToggled(b);
}
void MediaPlayerState::setFullscreen( bool b ) {
if ( fullscreen == b ) {
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h
index 7a80ad8..fc4e6cb 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.h
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h
@@ -43,33 +43,32 @@
class MediaPlayerDecoder;
class Config;
class MediaPlayerState : public QObject {
Q_OBJECT
public:
MediaPlayerState( QObject *parent, const char *name );
~MediaPlayerState();
bool isStreaming() const { return streaming; }
bool isSeekable() const { return seekable; }
bool isFullscreen() const { return fullscreen; }
bool isScaled() const { return scaled; }
bool isLooping() const { return looping; }
bool isShuffled() const { return shuffled; }
- bool isUsingPlaylist() const { return usePlaylist; }
bool isPaused() const { return paused; }
bool isPlaying() const { return playing; }
bool isStopped() const { return stopped; }
long position() const { return curPosition; }
long length() const { return curLength; }
char view() const { return curView; }
public slots:
void setIsStreaming( bool b );
void setIsSeekable( bool b );
void setFullscreen( bool b );
void setScaled( bool b );
void setLooping( bool b );
void setShuffled( bool b );
void setPaused( bool b );
void setPlaying( bool b );
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 5b277cc..f53def6 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -192,41 +192,37 @@ void PlayListWidget::writeDefaultPlaylist() {
do {
// qDebug(d->selectedFiles->current()->file());
m3uList->add( d->selectedFiles->current()->file() );
}
while ( d->selectedFiles->next() );
m3uList->write();
m3uList->close();
if(m3uList) delete m3uList;
}
}
}
void PlayListWidget::addToSelection( const DocLnk& lnk ) {
d->setDocumentUsed = FALSE;
- if ( mediaPlayerState->isUsingPlaylist() ) {
- if( QFileInfo( lnk.file() ).exists() ||
- lnk.file().left(4) == "http" ) {
- d->selectedFiles->addToSelection( lnk );
- }
-// writeCurrentM3u();
+ if( QFileInfo( lnk.file() ).exists() ||
+ lnk.file().left(4) == "http" ) {
+ d->selectedFiles->addToSelection( lnk );
}
- else
- mediaPlayerState->setPlaying( TRUE );
+// writeCurrentM3u();
}
void PlayListWidget::clearList() {
while ( first() ) {
d->selectedFiles->removeSelected();
}
}
void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) {
switch (mouse) {
case 1:
break;
case 2:
{
QPopupMenu m;
@@ -409,104 +405,86 @@ void PlayListWidget::setDocument( const QString& fileref ) {
d->setDocumentUsed = TRUE;
mediaPlayerState->setPlaying( FALSE );
mediaPlayerState->setPlaying( TRUE );
}
}
void PlayListWidget::useSelectedDocument() {
d->setDocumentUsed = FALSE;
}
const DocLnk *PlayListWidget::current() const { // this is fugly
assert( currentTab() == CurrentPlayList );
-// qDebug("playlist");
- if ( mediaPlayerState->isUsingPlaylist() )
- return d->selectedFiles->current();
-
- assert( false );
+ return d->selectedFiles->current();
}
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();
+ 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() )
+ if ( !d->selectedFiles->next() ) {
+ d->selectedFiles->first();
}
- if ( cur == current() )
- if ( !d->selectedFiles->next() ) {
- d->selectedFiles->first();
- }
- return TRUE;
- } else {
- if ( !d->selectedFiles->prev() ) {
- if ( mediaPlayerState->isLooping() ) {
- return d->selectedFiles->last();
- } else {
- return FALSE;
- }
+ return TRUE;
+ } else {
+ if ( !d->selectedFiles->prev() ) {
+ if ( mediaPlayerState->isLooping() ) {
+ return d->selectedFiles->last();
+ } else {
+ return FALSE;
}
- return TRUE;
}
- } else {
- return mediaPlayerState->isLooping();
- }
+ return TRUE;
+ }
}
bool PlayListWidget::next() {
//qDebug("<<<<<<<<<<<<next()");
- if ( mediaPlayerState->isUsingPlaylist() ) {
- if ( mediaPlayerState->isShuffled() ) {
- return prev();
- } else {
- if ( !d->selectedFiles->next() ) {
- if ( mediaPlayerState->isLooping() ) {
- return d->selectedFiles->first();
- } else {
- return FALSE;
- }
+ if ( mediaPlayerState->isShuffled() ) {
+ return prev();
+ } else {
+ if ( !d->selectedFiles->next() ) {
+ if ( mediaPlayerState->isLooping() ) {
+ return d->selectedFiles->first();
+ } else {
+ return FALSE;
}
- return TRUE;
}
- } else {
- return mediaPlayerState->isLooping();
+ return TRUE;
}
}
bool PlayListWidget::first() {
- if ( mediaPlayerState->isUsingPlaylist() )
- return d->selectedFiles->first();
- else
- return mediaPlayerState->isLooping();
+ return d->selectedFiles->first();
}
bool PlayListWidget::last() {
- if ( mediaPlayerState->isUsingPlaylist() )
- return d->selectedFiles->last();
- else
- return mediaPlayerState->isLooping();
+ return d->selectedFiles->last();
}
void PlayListWidget::saveList() {
writem3u();
}
void PlayListWidget::loadList( const DocLnk & lnk) {
QString name = lnk.name();
// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
if( name.length()>0) {
setCaption("OpiePlayer: "+name);
// qDebug("<<<<<<<<<<<<load list "+ lnk.file());
clearList();