summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
Side-by-side diff
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayerstate.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index 22451b7..6806adc 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -20,95 +20,103 @@
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
// this file is based on work by trolltech
#include <qpe/qpeapplication.h>
#include <qpe/qlibrary.h>
#include <qpe/config.h>
#include <qvaluelist.h>
#include <qobject.h>
#include <qdir.h>
#include "mediaplayerstate.h"
-
+#include <assert.h>
//#define MediaPlayerDebug(x) qDebug x
#define MediaPlayerDebug(x)
MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
: QObject( parent, name ) {
Config cfg( "OpiePlayer" );
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" );
videoGamma = cfg.readNumEntry( "VideoGamma" );
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( "VideoGamma", videoGamma );
}
-MediaPlayerState::MediaType MediaPlayerState::mediaType() const
+MediaPlayerState::DisplayType MediaPlayerState::displayType() const
{
- return view() == 'a' ? MediaPlayerState::Audio : MediaPlayerState::Video;
+ char v = view();
+ switch ( v ) {
+ case 'a': return MediaPlayerState::Audio;
+ case 'v': return MediaPlayerState::Video;
+ case 'l': return MediaPlayerState::MediaSelection;
+ default: assert( false );
+ }
+ // never reached
+ return MediaPlayerState::MediaSelection;
}
// 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 ) {
@@ -187,49 +195,49 @@ void MediaPlayerState::updatePosition( long 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 ) {
if ( curView == v ) {
return;
}
curView = v;
emit viewChanged(v);
- emit mediaTypeChanged( mediaType() );
+ emit displayTypeChanged( displayType() );
}
void MediaPlayerState::setPrev(){
emit prev();
}
void MediaPlayerState::setNext() {
emit next();
}
void MediaPlayerState::setList() {
setPlaying( FALSE );
setView('l');
}
void MediaPlayerState::setVideo() {
setView('v');
}
void MediaPlayerState::setAudio() {
setView('a');
}
void MediaPlayerState::toggleFullscreen() {