-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 39 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 6 |
2 files changed, 29 insertions, 16 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 6806adc..901b43f 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp | |||
@@ -71,9 +71,9 @@ void MediaPlayerState::readConfig( Config& cfg ) { | |||
71 | streaming = FALSE; | 71 | streaming = FALSE; |
72 | paused = FALSE; | 72 | paused = FALSE; |
73 | curPosition = 0; | 73 | curPosition = 0; |
74 | curLength = 0; | 74 | curLength = 0; |
75 | curView = 'l'; | 75 | m_displayType = MediaSelection; |
76 | } | 76 | } |
77 | 77 | ||
78 | 78 | ||
79 | void MediaPlayerState::writeConfig( Config& cfg ) const { | 79 | void MediaPlayerState::writeConfig( Config& cfg ) const { |
@@ -84,19 +84,23 @@ void MediaPlayerState::writeConfig( Config& cfg ) const { | |||
84 | cfg.writeEntry( "Shuffle", shuffled ); | 84 | cfg.writeEntry( "Shuffle", shuffled ); |
85 | cfg.writeEntry( "VideoGamma", videoGamma ); | 85 | cfg.writeEntry( "VideoGamma", videoGamma ); |
86 | } | 86 | } |
87 | 87 | ||
88 | MediaPlayerState::DisplayType MediaPlayerState::displayType() const | 88 | char MediaPlayerState::view() const |
89 | { | 89 | { |
90 | char v = view(); | 90 | switch ( m_displayType ) { |
91 | switch ( v ) { | 91 | case Audio: return 'a'; |
92 | case 'a': return MediaPlayerState::Audio; | 92 | case Video: return 'v'; |
93 | case 'v': return MediaPlayerState::Video; | 93 | case MediaSelection: return 'l'; |
94 | case 'l': return MediaPlayerState::MediaSelection; | ||
95 | default: assert( false ); | 94 | default: assert( false ); |
96 | } | 95 | } |
97 | // never reached | 96 | // never reached |
98 | return MediaPlayerState::MediaSelection; | 97 | return 42; |
98 | } | ||
99 | |||
100 | MediaPlayerState::DisplayType MediaPlayerState::displayType() const | ||
101 | { | ||
102 | return m_displayType; | ||
99 | } | 103 | } |
100 | 104 | ||
101 | // slots | 105 | // slots |
102 | void MediaPlayerState::setIsStreaming( bool b ) { | 106 | void MediaPlayerState::setIsStreaming( bool b ) { |
@@ -210,14 +214,23 @@ void MediaPlayerState::setLength( long l ) { | |||
210 | emit lengthChanged(l); | 214 | emit lengthChanged(l); |
211 | } | 215 | } |
212 | 216 | ||
213 | void MediaPlayerState::setView( char v ) { | 217 | void MediaPlayerState::setView( char v ) { |
214 | if ( curView == v ) { | 218 | switch ( v ) { |
215 | return; | 219 | case 'a': setDisplayType( Audio ); return; |
220 | case 'v': setDisplayType( Video ); return; | ||
221 | case 'l': setDisplayType( MediaSelection ); return; | ||
222 | default: assert( false ); | ||
216 | } | 223 | } |
217 | curView = v; | 224 | } |
218 | emit viewChanged(v); | 225 | |
219 | emit displayTypeChanged( displayType() ); | 226 | void MediaPlayerState::setDisplayType( DisplayType displayType ) |
227 | { | ||
228 | if ( m_displayType == displayType ) | ||
229 | return; | ||
230 | |||
231 | m_displayType = displayType; | ||
232 | emit displayTypeChanged( m_displayType ); | ||
220 | } | 233 | } |
221 | 234 | ||
222 | void MediaPlayerState::setPrev(){ | 235 | void MediaPlayerState::setPrev(){ |
223 | emit prev(); | 236 | emit prev(); |
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index ca531c5..b18780b 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h | |||
@@ -62,9 +62,9 @@ public: | |||
62 | bool isPlaying() const { return playing; } | 62 | bool isPlaying() const { return playing; } |
63 | bool isStopped() const { return stopped; } | 63 | bool isStopped() const { return stopped; } |
64 | long position() const { return curPosition; } | 64 | long position() const { return curPosition; } |
65 | long length() const { return curLength; } | 65 | long length() const { return curLength; } |
66 | char view() const { return curView; } | 66 | char view() const; |
67 | DisplayType displayType() const; | 67 | DisplayType displayType() const; |
68 | 68 | ||
69 | public slots: | 69 | public slots: |
70 | void setIsStreaming( bool b ); | 70 | void setIsStreaming( bool b ); |
@@ -79,8 +79,9 @@ public slots: | |||
79 | void setPosition( long p ); | 79 | void setPosition( long p ); |
80 | void updatePosition( long p ); | 80 | void updatePosition( long p ); |
81 | void setLength( long l ); | 81 | void setLength( long l ); |
82 | void setView( char v ); | 82 | void setView( char v ); |
83 | void setDisplayType( MediaPlayerState::DisplayType displayType ); | ||
83 | void setBlanked( bool b ); | 84 | void setBlanked( bool b ); |
84 | void setVideoGamma( int v ); | 85 | void setVideoGamma( int v ); |
85 | 86 | ||
86 | void setPrev(); | 87 | void setPrev(); |
@@ -109,9 +110,8 @@ signals: | |||
109 | void stopToggled( bool ); | 110 | void stopToggled( bool ); |
110 | void positionChanged( long ); // When the slider is moved | 111 | void positionChanged( long ); // When the slider is moved |
111 | void positionUpdated( long ); // When the media file progresses | 112 | void positionUpdated( long ); // When the media file progresses |
112 | void lengthChanged( long ); | 113 | void lengthChanged( long ); |
113 | void viewChanged( char ); | ||
114 | void displayTypeChanged( MediaPlayerState::DisplayType type ); | 114 | void displayTypeChanged( MediaPlayerState::DisplayType type ); |
115 | void isSeekableToggled( bool ); | 115 | void isSeekableToggled( bool ); |
116 | void blankToggled( bool ); | 116 | void blankToggled( bool ); |
117 | void videoGammaChanged( int ); | 117 | void videoGammaChanged( int ); |
@@ -131,9 +131,9 @@ private: | |||
131 | bool playing : 1; | 131 | bool playing : 1; |
132 | bool stopped : 1; | 132 | bool stopped : 1; |
133 | long curPosition; | 133 | long curPosition; |
134 | long curLength; | 134 | long curLength; |
135 | char curView; | 135 | DisplayType m_displayType; |
136 | int videoGamma; | 136 | int videoGamma; |
137 | void readConfig( Config& cfg ); | 137 | void readConfig( Config& cfg ); |
138 | 138 | ||
139 | }; | 139 | }; |