summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp27
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h2
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp10
5 files changed, 12 insertions, 35 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 74ab2e3..68bbae9 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -134,65 +134,65 @@ void MediaPlayer::setPlaying( bool play ) {
void MediaPlayer::prev() {
if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist
if ( playList->prev() ) {
play();
} else if ( mediaPlayerState->isLooping() ) {
if ( playList->last() ) {
play();
}
} else {
mediaPlayerState->setList();
}
}
}
void MediaPlayer::next() {
if(playList->currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist
if ( playList->next() ) {
play();
} else if ( mediaPlayerState->isLooping() ) {
if ( playList->first() ) {
play();
}
} else {
mediaPlayerState->setList();
}
} else { //if playing from file list, let's just stop
qDebug("<<<<<<<<<<<<<<<<<stop for filelists");
mediaPlayerState->setPlaying(false);
- mediaPlayerState->setView('l');
+ mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection );
if(l) mediaPlayerState->setLooping(l);
if(r) mediaPlayerState->setShuffled(r);
}
qApp->processEvents();
}
void MediaPlayer::startDecreasingVolume() {
volumeDirection = -1;
startTimer( 100 );
volControl->decVol(2);
}
void MediaPlayer::startIncreasingVolume() {
volumeDirection = +1;
startTimer( 100 );
volControl->incVol(2);
}
bool drawnOnScreenDisplay = FALSE;
unsigned int onScreenDisplayVolume = 0;
const int yoff = 110;
void MediaPlayer::stopChangingVolume() {
killTimers();
// Get rid of the on-screen display stuff
drawnOnScreenDisplay = FALSE;
onScreenDisplayVolume = 0;
int w=0;
int h=0;
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index 901b43f..40fa1a4 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -56,76 +56,64 @@ MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
}
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" );
videoGamma = cfg.readNumEntry( "VideoGamma" );
playing = FALSE;
streaming = FALSE;
paused = FALSE;
curPosition = 0;
curLength = 0;
m_displayType = MediaSelection;
}
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( "VideoGamma", videoGamma );
}
-char MediaPlayerState::view() const
-{
- switch ( m_displayType ) {
- case Audio: return 'a';
- case Video: return 'v';
- case MediaSelection: return 'l';
- default: assert( false );
- }
- // never reached
- return 42;
-}
-
MediaPlayerState::DisplayType MediaPlayerState::displayType() const
{
return m_displayType;
}
// 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 ) {
return;
}
fullscreen = b;
emit fullscreenToggled(b);
}
void MediaPlayerState::setBlanked( bool b ) {
if ( blanked == b ) {
return;
}
blanked = b;
emit blankToggled(b);
}
@@ -185,101 +173,92 @@ void MediaPlayerState::setStopped( bool b ) {
void MediaPlayerState::setPosition( long p ) {
if ( curPosition == p ) {
return;
}
curPosition = p;
emit positionChanged(p);
}
void MediaPlayerState::updatePosition( long p ){
if ( curPosition == p ) {
return;
}
curPosition = p;
emit positionUpdated(p);
}
void MediaPlayerState::setVideoGamma( int v ){
if ( videoGamma == v ) {
return;
}
videoGamma = v;
emit videoGammaChanged( v );
}
void MediaPlayerState::setLength( long l ) {
if ( curLength == l ) {
return;
}
curLength = l;
emit lengthChanged(l);
}
-void MediaPlayerState::setView( char v ) {
- switch ( v ) {
- case 'a': setDisplayType( Audio ); return;
- case 'v': setDisplayType( Video ); return;
- case 'l': setDisplayType( MediaSelection ); return;
- default: assert( false );
- }
-}
-
void MediaPlayerState::setDisplayType( DisplayType displayType )
{
if ( m_displayType == displayType )
return;
m_displayType = displayType;
emit displayTypeChanged( m_displayType );
}
void MediaPlayerState::setPrev(){
emit prev();
}
void MediaPlayerState::setNext() {
emit next();
}
void MediaPlayerState::setList() {
setPlaying( FALSE );
- setView('l');
+ setDisplayType( MediaSelection );
}
void MediaPlayerState::setVideo() {
- setView('v');
+ setDisplayType( Video );
}
void MediaPlayerState::setAudio() {
- setView('a');
+ setDisplayType( Audio );
}
void MediaPlayerState::toggleFullscreen() {
setFullscreen( !fullscreen );
}
void MediaPlayerState::toggleScaled() {
setScaled( !scaled);
}
void MediaPlayerState::toggleLooping() {
setLooping( !looping);
}
void MediaPlayerState::toggleShuffled() {
setShuffled( !shuffled);
}
void MediaPlayerState::togglePaused() {
setPaused( !paused);
}
void MediaPlayerState::togglePlaying() {
setPlaying( !playing);
}
void MediaPlayerState::toggleBlank() {
setBlanked( !blanked);
}
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h
index b18780b..c887bb8 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.h
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h
@@ -34,81 +34,79 @@
// this file is based on work by trolltech
#ifndef MEDIA_PLAYER_STATE_H
#define MEDIA_PLAYER_STATE_H
#include <qobject.h>
class MediaPlayerDecoder;
class Config;
class MediaPlayerState : public QObject {
Q_OBJECT
public:
enum DisplayType { Audio, Video, MediaSelection };
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 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;
DisplayType displayType() const;
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 );
void setStopped( bool b );
void setPosition( long p );
void updatePosition( long p );
void setLength( long l );
- void setView( char v );
void setDisplayType( MediaPlayerState::DisplayType displayType );
void setBlanked( bool b );
void setVideoGamma( int v );
void setPrev();
void setNext();
void setList();
void setVideo();
void setAudio();
void toggleFullscreen();
void toggleScaled();
void toggleLooping();
void toggleShuffled();
void togglePaused();
void togglePlaying();
void toggleBlank();
void writeConfig( Config& cfg ) const;
signals:
void fullscreenToggled( bool );
void scaledToggled( bool );
void loopingToggled( bool );
void shuffledToggled( bool );
void pausedToggled( bool );
void playingToggled( bool );
void stopToggled( bool );
void positionChanged( long ); // When the slider is moved
void positionUpdated( long ); // When the media file progresses
void lengthChanged( long );
void displayTypeChanged( MediaPlayerState::DisplayType type );
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index db7c979..8be7a2f 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -192,37 +192,37 @@ PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags
//playlists list
QWidget *LTab;
LTab = new QWidget( tabWidget, "LTab" );
QGridLayout *Llayout = new QGridLayout( LTab );
Llayout->setSpacing( 2 );
Llayout->setMargin( 2 );
playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE );
Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 );
tabWidget->insertTab( LTab, tr( "Lists" ) );
setCentralWidget( vbox5 );
}
PlayListWidgetGui::~PlayListWidgetGui() {
}
void PlayListWidgetGui::setView( char view ) {
if ( view == 'l' )
showMaximized();
else
hide();
}
void PlayListWidgetGui::setActiveWindow() {
// qDebug("SETTING active window");
// When we get raised we need to ensure that it switches views
- char origView = mediaPlayerState->view();
- mediaPlayerState->setView( 'l' ); // invalidate
- mediaPlayerState->setView( origView ); // now switch back
+ MediaPlayerState::DisplayType origDisplayType = mediaPlayerState->displayType();
+ mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); // invalidate
+ mediaPlayerState->setDisplayType( origDisplayType ); // now switch back
}
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 71e08a6..e7d5a7b 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -56,89 +56,89 @@ XineControl::XineControl( QObject *parent, const char *name )
connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) );
connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
disabledSuspendScreenSaver = FALSE;
}
XineControl::~XineControl() {
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
if ( disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = FALSE;
// Re-enable the suspend mode
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
}
#endif
delete libXine;
}
void XineControl::play( const QString& fileName ) {
hasVideoChannel = FALSE;
hasAudioChannel = FALSE;
m_fileName = fileName;
qDebug("<<FILENAME: " + fileName + ">>>>");
if ( !libXine->play( fileName, 0, 0 ) ) {
QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
// toggle stop so the the play button is reset
mediaPlayerState->setPlaying( false );
return;
}
mediaPlayerState->setPlaying( true );
- char whichGui;
+ MediaPlayerState::DisplayType displayType;
// qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) );
if ( !libXine->hasVideo() ) {
- whichGui = 'a';
+ displayType = MediaPlayerState::Audio;
qDebug("HAS AUDIO");
libXine->setShowVideo( false );
hasAudioChannel = TRUE;
} else {
- whichGui = 'v';
+ displayType = MediaPlayerState::Video;
qDebug("HAS VIDEO");
libXine->setShowVideo( true );
hasVideoChannel = TRUE;
}
// determine if slider is shown
mediaPlayerState->setIsSeekable( libXine->isSeekable() );
// which gui (video / audio)
- mediaPlayerState->setView( whichGui );
+ mediaPlayerState->setDisplayType( displayType );
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
if ( !disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = TRUE;
// Stop the screen from blanking and power saving state
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" )
- << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend );
+ << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend );
}
#endif
length();
position();
}
void XineControl::nextMedia() {
mediaPlayerState->setNext();
}
void XineControl::setGamma( int value ) {
libXine->setGamma( value );
}
void XineControl::stop( bool isSet ) {
if ( !isSet ) {
libXine->stop();
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
if ( disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = FALSE;
// Re-enable the suspend mode
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
}
#endif
}
}
/**
* Pause playback
* @isSet