summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
authorsimon <simon>2002-12-02 19:20:59 (UTC)
committer simon <simon>2002-12-02 19:20:59 (UTC)
commit24081d2efe5860c9656716b04af00e5ab85d1cd3 (patch) (unidiff)
treeaf0a952e87220242aab54bfae4010c667b60aca9 /noncore/multimedia/opieplayer2/mediaplayerstate.cpp
parent54665278a9b7d703deb73ede0d74d3948c265b39 (diff)
downloadopie-24081d2efe5860c9656716b04af00e5ab85d1cd3.zip
opie-24081d2efe5860c9656716b04af00e5ab85d1cd3.tar.gz
opie-24081d2efe5860c9656716b04af00e5ab85d1cd3.tar.bz2
- another step to switch to from char view to DisplayType
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayerstate.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp39
1 files changed, 26 insertions, 13 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
@@ -69,36 +69,40 @@ void MediaPlayerState::readConfig( Config& cfg ) {
69 videoGamma = cfg.readNumEntry( "VideoGamma" ); 69 videoGamma = cfg.readNumEntry( "VideoGamma" );
70 playing = FALSE; 70 playing = FALSE;
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
79void MediaPlayerState::writeConfig( Config& cfg ) const { 79void MediaPlayerState::writeConfig( Config& cfg ) const {
80 cfg.setGroup( "Options" ); 80 cfg.setGroup( "Options" );
81 cfg.writeEntry( "FullScreen", fullscreen ); 81 cfg.writeEntry( "FullScreen", fullscreen );
82 cfg.writeEntry( "Scaling", scaled ); 82 cfg.writeEntry( "Scaling", scaled );
83 cfg.writeEntry( "Looping", looping ); 83 cfg.writeEntry( "Looping", looping );
84 cfg.writeEntry( "Shuffle", shuffled ); 84 cfg.writeEntry( "Shuffle", shuffled );
85 cfg.writeEntry( "VideoGamma", videoGamma ); 85 cfg.writeEntry( "VideoGamma", videoGamma );
86} 86}
87 87
88MediaPlayerState::DisplayType MediaPlayerState::displayType() const 88char 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
100MediaPlayerState::DisplayType MediaPlayerState::displayType() const
101{
102 return m_displayType;
99} 103}
100 104
101// slots 105// slots
102void MediaPlayerState::setIsStreaming( bool b ) { 106void MediaPlayerState::setIsStreaming( bool b ) {
103 streaming = b; 107 streaming = b;
104} 108}
@@ -208,18 +212,27 @@ void MediaPlayerState::setLength( long l ) {
208 } 212 }
209 curLength = l; 213 curLength = l;
210 emit lengthChanged(l); 214 emit lengthChanged(l);
211} 215}
212 216
213void MediaPlayerState::setView( char v ) { 217void 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() ); 226void 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
222void MediaPlayerState::setPrev(){ 235void MediaPlayerState::setPrev(){
223 emit prev(); 236 emit prev();
224} 237}
225 238