Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

mediaplayerstate.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 #ifndef MEDIA_PLAYER_STATE_H
00021 #define MEDIA_PLAYER_STATE_H
00022 
00023 
00024 #include <qobject.h>
00025 
00026 
00027 class MediaPlayerDecoder;
00028 class Config;
00029 
00030 
00031 class MediaPlayerState : public QObject {
00032 Q_OBJECT
00033 public:
00034     MediaPlayerState( QObject *parent, const char *name );
00035     ~MediaPlayerState();
00036     bool isPaused;
00037 
00038     bool isStreaming;    
00039     bool fullscreen()    { return isFullscreen; }
00040     bool scaled()    { return isScaled; }
00041     bool looping()     { return isLooping; }
00042     bool shuffled()    { return isShuffled; }
00043     bool playlist()    { return usePlaylist; }
00044     bool paused()    { return isPaused; }
00045     bool playing()     { return isPlaying; }
00046     long position()    { return curPosition; }
00047     long length()    { return curLength; }
00048     char view()      { return curView; }
00049 
00050     MediaPlayerDecoder *newDecoder( const QString& file );
00051     MediaPlayerDecoder *curDecoder();
00052     MediaPlayerDecoder *libMpeg3Decoder(); // ### Yucky hack needed to use libmpeg3plugin to get the
00053              // number of audio samples if we are using the libmad plugin
00054 public slots:
00055     void setFullscreen( bool b ) { if ( isFullscreen == b ) return; isFullscreen = b; emit fullscreenToggled(b); }
00056     void setScaled( bool b )     { if ( isScaled     == b ) return; isScaled = b;     emit scaledToggled(b); }
00057     void setLooping( bool b )    { if ( isLooping    == b ) return; isLooping = b;    emit loopingToggled(b); }
00058     void setShuffled( bool b )   { if ( isShuffled   == b ) return; isShuffled = b;   emit shuffledToggled(b); }
00059     void setPlaylist( bool b )   { if ( usePlaylist  == b ) return; usePlaylist = b;  emit playlistToggled(b); }
00060     void setPaused( bool b )   { if ( isPaused     == b ) return; isPaused = b;     emit pausedToggled(b); }
00061 
00062     void setPlaying( bool b )  { if ( isPlaying == b )  return; isPlaying = b; emit playingToggled(b); }
00063     
00064     void setPosition( long p )   { if ( curPosition  == p ) return; curPosition = p;  emit positionChanged(p); }
00065     void updatePosition( long p ){ if ( curPosition  == p ) return; curPosition = p;  emit positionUpdated(p); }
00066     void setLength( long l )   { if ( curLength    == l ) return; curLength = l;    emit lengthChanged(l); }
00067     void setView( char v )   { if ( curView      == v ) return; curView = v;      emit viewChanged(v); }
00068 
00069     void setPrev()     { emit prev(); }
00070     void setNext()     { emit next(); }
00071     void setList()     { setPlaying( FALSE ); setView('l'); }
00072     void setVideo()    { setView('v'); }
00073     void setAudio()    { setView('a'); }
00074 
00075     void toggleFullscreen()  { setFullscreen( !isFullscreen ); }
00076     void toggleScaled()    { setScaled( !isScaled); }
00077     void toggleLooping()   { setLooping( !isLooping); }
00078     void toggleShuffled()  { setShuffled( !isShuffled); }
00079     void togglePlaylist()  { setPlaylist( !usePlaylist); }
00080     void togglePaused()    { setPaused( !isPaused); }
00081     void togglePlaying()   { setPlaying( !isPlaying); }
00082 
00083 signals:
00084     void fullscreenToggled( bool );
00085     void scaledToggled( bool );
00086     void loopingToggled( bool );
00087     void shuffledToggled( bool );
00088     void playlistToggled( bool );
00089     void pausedToggled( bool );
00090     void playingToggled( bool );
00091     void positionChanged( long ); // When the slider is moved
00092     void positionUpdated( long ); // When the media file progresses
00093     void lengthChanged( long );
00094     void viewChanged( char );
00095 
00096     void prev();
00097     void next();
00098 
00099 private:
00100     bool isFullscreen;
00101     bool isScaled;
00102     bool isLooping;
00103     bool isShuffled;
00104     bool usePlaylist;
00105     bool isPlaying;
00106     long curPosition;
00107     long curLength;
00108     char curView;
00109 
00110     MediaPlayerDecoder *decoder;
00111     MediaPlayerDecoder *libmpeg3decoder;
00112 //    MediaPlayerDecoder *libwavdecoder;
00113 
00114     void loadPlugins();
00115     void readConfig( Config& cfg );
00116     void writeConfig( Config& cfg ) const;
00117 };
00118 
00119 
00120 #endif // MEDIA_PLAYER_STATE_H
00121 

Generated on Sat Nov 5 16:15:38 2005 for OPIE by  doxygen 1.4.2