summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/mediaplayerstate.h
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/mediaplayerstate.h') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/mediaplayerstate.h117
1 files changed, 117 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/mediaplayerstate.h b/core/multimedia/opieplayer/mediaplayerstate.h
new file mode 100644
index 0000000..5d95b92
--- a/dev/null
+++ b/core/multimedia/opieplayer/mediaplayerstate.h
@@ -0,0 +1,117 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef MEDIA_PLAYER_STATE_H
21#define MEDIA_PLAYER_STATE_H
22
23
24#include <qobject.h>
25
26
27class MediaPlayerDecoder;
28class Config;
29
30
31class MediaPlayerState : public QObject {
32Q_OBJECT
33public:
34 MediaPlayerState( QObject *parent, const char *name );
35 ~MediaPlayerState();
36
37 bool fullscreen() { return isFullscreen; }
38 bool scaled() { return isScaled; }
39 bool looping() { return isLooping; }
40 bool shuffled() { return isShuffled; }
41 bool playlist() { return usePlaylist; }
42 bool paused() { return isPaused; }
43 bool playing() { return isPlaying; }
44 long position() { return curPosition; }
45 long length() { return curLength; }
46 char view() { return curView; }
47
48 MediaPlayerDecoder *newDecoder( const QString& file );
49 MediaPlayerDecoder *curDecoder();
50 MediaPlayerDecoder *libMpeg3Decoder(); // ### Yucky hack needed to use libmpeg3plugin to get the
51 // number of audio samples if we are using the libmad plugin
52public slots:
53 void setFullscreen( bool b ) { if ( isFullscreen == b ) return; isFullscreen = b; emit fullscreenToggled(b); }
54 void setScaled( bool b ) { if ( isScaled == b ) return; isScaled = b; emit scaledToggled(b); }
55 void setLooping( bool b ) { if ( isLooping == b ) return; isLooping = b; emit loopingToggled(b); }
56 void setShuffled( bool b ) { if ( isShuffled == b ) return; isShuffled = b; emit shuffledToggled(b); }
57 void setPlaylist( bool b ) { if ( usePlaylist == b ) return; usePlaylist = b; emit playlistToggled(b); }
58 void setPaused( bool b ) { if ( isPaused == b ) return; isPaused = b; emit pausedToggled(b); }
59 void setPlaying( bool b ) { if ( isPlaying == b ) return; isPlaying = b; emit playingToggled(b); }
60 void setPosition( long p ) { if ( curPosition == p ) return; curPosition = p; emit positionChanged(p); }
61 void updatePosition( long p ){ if ( curPosition == p ) return; curPosition = p; emit positionUpdated(p); }
62 void setLength( long l ) { if ( curLength == l ) return; curLength = l; emit lengthChanged(l); }
63 void setView( char v ) { if ( curView == v ) return; curView = v; emit viewChanged(v); }
64
65 void setPrev() { emit prev(); }
66 void setNext() { emit next(); }
67 void setList() { setPlaying( FALSE ); setView('l'); }
68 void setVideo() { setView('v'); }
69 void setAudio() { setView('a'); }
70
71 void toggleFullscreen() { setFullscreen( !isFullscreen ); }
72 void toggleScaled() { setScaled( !isScaled); }
73 void toggleLooping() { setLooping( !isLooping); }
74 void toggleShuffled() { setShuffled( !isShuffled); }
75 void togglePlaylist() { setPlaylist( !usePlaylist); }
76 void togglePaused() { setPaused( !isPaused); }
77 void togglePlaying() { setPlaying( !isPlaying); }
78
79signals:
80 void fullscreenToggled( bool );
81 void scaledToggled( bool );
82 void loopingToggled( bool );
83 void shuffledToggled( bool );
84 void playlistToggled( bool );
85 void pausedToggled( bool );
86 void playingToggled( bool );
87 void positionChanged( long ); // When the slider is moved
88 void positionUpdated( long ); // When the media file progresses
89 void lengthChanged( long );
90 void viewChanged( char );
91
92 void prev();
93 void next();
94
95private:
96 bool isFullscreen;
97 bool isScaled;
98 bool isLooping;
99 bool isShuffled;
100 bool usePlaylist;
101 bool isPaused;
102 bool isPlaying;
103 long curPosition;
104 long curLength;
105 char curView;
106
107 MediaPlayerDecoder *decoder;
108 MediaPlayerDecoder *libmpeg3decoder;
109
110 void loadPlugins();
111 void readConfig( Config& cfg );
112 void writeConfig( Config& cfg ) const;
113};
114
115
116#endif // MEDIA_PLAYER_STATE_H
117