summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp14
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp16
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h6
4 files changed, 23 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 74bc390..1600320 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -131,65 +131,65 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
131 buttonPixUp[i] = 0l; 131 buttonPixUp[i] = 0l;
132 buttonPixDown[i] = 0l; 132 buttonPixDown[i] = 0l;
133 } 133 }
134 134
135 setBackgroundPixmap( pixBg ); 135 setBackgroundPixmap( pixBg );
136 136
137 songInfo.setFocusPolicy( QWidget::NoFocus ); 137 songInfo.setFocusPolicy( QWidget::NoFocus );
138// changeTextColor( &songInfo ); 138// changeTextColor( &songInfo );
139// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 139// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
140// songInfo.setFrameStyle( QFrame::NoFrame); 140// songInfo.setFrameStyle( QFrame::NoFrame);
141 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); 141 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
142// songInfo.setForegroundColor(Qt::white); 142// songInfo.setForegroundColor(Qt::white);
143 143
144 slider.setFixedHeight( 20 ); 144 slider.setFixedHeight( 20 );
145 slider.setMinValue( 0 ); 145 slider.setMinValue( 0 );
146 slider.setMaxValue( 1 ); 146 slider.setMaxValue( 1 );
147 slider.setFocusPolicy( QWidget::NoFocus ); 147 slider.setFocusPolicy( QWidget::NoFocus );
148 slider.setBackgroundPixmap( pixBg ); 148 slider.setBackgroundPixmap( pixBg );
149 149
150// Config cofg("qpe"); 150// Config cofg("qpe");
151// cofg.setGroup("Appearance"); 151// cofg.setGroup("Appearance");
152// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); 152// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) );
153 153
154 time.setFocusPolicy( QWidget::NoFocus ); 154 time.setFocusPolicy( QWidget::NoFocus );
155 time.setAlignment( Qt::AlignCenter ); 155 time.setAlignment( Qt::AlignCenter );
156 156
157// time.setFrame(FALSE); 157// time.setFrame(FALSE);
158// changeTextColor( &time ); 158// changeTextColor( &time );
159 159
160 resizeEvent( NULL ); 160 resizeEvent( NULL );
161 161
162 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 162 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
163 connect( mediaPlayerState, SIGNAL( mediaTypeChanged(MediaPlayerState::MediaType) ), this, SLOT( setMediaType(MediaPlayerState::MediaType) ) ); 163 connect( mediaPlayerState, SIGNAL( displayTypeChanged(MediaPlayerState::DisplayType) ), this, SLOT( setDisplayType(MediaPlayerState::DisplayType) ) );
164 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 164 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
165 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 165 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
166 connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); 166 connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) );
167 167
168 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); 168 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) );
169 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); 169 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) );
170 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); 170 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) );
171 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); 171 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) );
172 172
173 // Intialise state 173 // Intialise state
174 setLength( mediaPlayerState->length() ); 174 setLength( mediaPlayerState->length() );
175 setPosition( mediaPlayerState->position() ); 175 setPosition( mediaPlayerState->position() );
176 setLooping( mediaPlayerState->isFullscreen() ); 176 setLooping( mediaPlayerState->isFullscreen() );
177 // setPaused( mediaPlayerState->paused() ); 177 // setPaused( mediaPlayerState->paused() );
178 setPlaying( mediaPlayerState->isPlaying() ); 178 setPlaying( mediaPlayerState->isPlaying() );
179 179
180} 180}
181 181
182AudioWidget::~AudioWidget() { 182AudioWidget::~AudioWidget() {
183 183
184 for ( int i = 0; i < 10; i++ ) { 184 for ( int i = 0; i < 10; i++ ) {
185 delete buttonPixUp[i]; 185 delete buttonPixUp[i];
186 delete buttonPixDown[i]; 186 delete buttonPixDown[i];
187 } 187 }
188 for ( int i = 0; i < 10; i++ ) { 188 for ( int i = 0; i < 10; i++ ) {
189 delete masks[i]; 189 delete masks[i];
190 } 190 }
191// mediaPlayerState->setPlaying(false); 191// mediaPlayerState->setPlaying(false);
192} 192}
193 193
194namespace { 194namespace {
195 195
@@ -235,73 +235,73 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
235 buttonPixDown[i] = maskPixToMask( pixDn, *masks[i] ); 235 buttonPixDown[i] = maskPixToMask( pixDn, *masks[i] );
236 } 236 }
237 } 237 }
238} 238}
239 239
240static bool audioSliderBeingMoved = FALSE; 240static bool audioSliderBeingMoved = FALSE;
241 241
242 242
243void AudioWidget::sliderPressed() { 243void AudioWidget::sliderPressed() {
244 audioSliderBeingMoved = TRUE; 244 audioSliderBeingMoved = TRUE;
245} 245}
246 246
247 247
248void AudioWidget::sliderReleased() { 248void AudioWidget::sliderReleased() {
249 audioSliderBeingMoved = FALSE; 249 audioSliderBeingMoved = FALSE;
250 if ( slider.width() == 0 ) 250 if ( slider.width() == 0 )
251 return; 251 return;
252 long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); 252 long val = long((double)slider.value() * mediaPlayerState->length() / slider.width());
253 mediaPlayerState->setPosition( val ); 253 mediaPlayerState->setPosition( val );
254} 254}
255 255
256void AudioWidget::setPosition( long i ) { 256void AudioWidget::setPosition( long i ) {
257 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 257 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
258 updateSlider( i, mediaPlayerState->length() ); 258 updateSlider( i, mediaPlayerState->length() );
259} 259}
260 260
261 261
262void AudioWidget::setLength( long max ) { 262void AudioWidget::setLength( long max ) {
263 updateSlider( mediaPlayerState->position(), max ); 263 updateSlider( mediaPlayerState->position(), max );
264} 264}
265 265
266 266
267void AudioWidget::setMediaType( MediaPlayerState::MediaType mediaType ) { 267void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) {
268 if ( mediaType == MediaPlayerState::Video ) { 268 if ( mediaType == MediaPlayerState::Audio ) {
269 killTimers(); 269 // startTimer( 150 );
270 hide(); 270 showMaximized();
271 return; 271 return;
272 } 272 }
273 273
274 // startTimer( 150 ); 274 killTimers();
275 showMaximized(); 275 hide();
276} 276}
277 277
278 278
279void AudioWidget::setSeekable( bool isSeekable ) { 279void AudioWidget::setSeekable( bool isSeekable ) {
280 280
281 if ( !isSeekable ) { 281 if ( !isSeekable ) {
282 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); 282 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
283 if( !slider.isHidden()) { 283 if( !slider.isHidden()) {
284 slider.hide(); 284 slider.hide();
285 } 285 }
286 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 286 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
287 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 287 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
288 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 288 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
289 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 289 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
290 } else { 290 } else {
291 // this stops the slider from being moved, thus 291 // this stops the slider from being moved, thus
292 // does not stop stream when it reaches the end 292 // does not stop stream when it reaches the end
293 slider.show(); 293 slider.show();
294 qDebug( " CONNECT SET POSTION " ); 294 qDebug( " CONNECT SET POSTION " );
295 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 295 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
296 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 296 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
297 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 297 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
298 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 298 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
299 } 299 }
300} 300}
301 301
302 302
303static QString timeAsString( long length ) { 303static QString timeAsString( long length ) {
304 int minutes = length / 60; 304 int minutes = length / 60;
305 int seconds = length % 60; 305 int seconds = length % 60;
306 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); 306 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 );
307} 307}
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 3f0c059..91fcbc5 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -52,65 +52,65 @@ class QPixmap;
52 52
53namespace { 53namespace {
54 54
55enum AudioButtons { 55enum AudioButtons {
56 AudioPlay=0, 56 AudioPlay=0,
57 AudioStop, 57 AudioStop,
58 AudioNext, 58 AudioNext,
59 AudioPrevious, 59 AudioPrevious,
60 AudioVolumeUp, 60 AudioVolumeUp,
61 AudioVolumeDown, 61 AudioVolumeDown,
62 AudioLoop, 62 AudioLoop,
63 AudioPlayList, 63 AudioPlayList,
64 AudioForward, 64 AudioForward,
65 AudioBack 65 AudioBack
66}; 66};
67}; 67};
68 68
69class AudioWidget : public QWidget { 69class AudioWidget : public QWidget {
70 Q_OBJECT 70 Q_OBJECT
71public: 71public:
72 AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); 72 AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 );
73 ~AudioWidget(); 73 ~AudioWidget();
74 void setTickerText( const QString &text ) { songInfo.setText( text ); } 74 void setTickerText( const QString &text ) { songInfo.setText( text ); }
75public slots: 75public slots:
76 void updateSlider( long, long ); 76 void updateSlider( long, long );
77 void sliderPressed( ); 77 void sliderPressed( );
78 void sliderReleased( ); 78 void sliderReleased( );
79 void setLooping( bool b) { setToggleButton( AudioLoop, b ); } 79 void setLooping( bool b) { setToggleButton( AudioLoop, b ); }
80 void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } 80 void setPlaying( bool b) { setToggleButton( AudioPlay, b ); }
81 void setPosition( long ); 81 void setPosition( long );
82 void setLength( long ); 82 void setLength( long );
83 void setSeekable( bool ); 83 void setSeekable( bool );
84 void setMediaType( MediaPlayerState::MediaType mediaType ); 84 void setDisplayType( MediaPlayerState::DisplayType displayType );
85 85
86signals: 86signals:
87 void moreClicked(); 87 void moreClicked();
88 void lessClicked(); 88 void lessClicked();
89 void moreReleased(); 89 void moreReleased();
90 void lessReleased(); 90 void lessReleased();
91 void forwardClicked(); 91 void forwardClicked();
92 void backClicked(); 92 void backClicked();
93 void forwardReleased(); 93 void forwardReleased();
94 void backReleased(); 94 void backReleased();
95 void sliderMoved(long); 95 void sliderMoved(long);
96 96
97protected: 97protected:
98 void doBlank(); 98 void doBlank();
99 void doUnblank(); 99 void doUnblank();
100 void paintEvent( QPaintEvent *pe ); 100 void paintEvent( QPaintEvent *pe );
101 void showEvent( QShowEvent *se ); 101 void showEvent( QShowEvent *se );
102 void resizeEvent( QResizeEvent *re ); 102 void resizeEvent( QResizeEvent *re );
103 void mouseMoveEvent( QMouseEvent *event ); 103 void mouseMoveEvent( QMouseEvent *event );
104 void mousePressEvent( QMouseEvent *event ); 104 void mousePressEvent( QMouseEvent *event );
105 void mouseReleaseEvent( QMouseEvent *event ); 105 void mouseReleaseEvent( QMouseEvent *event );
106 void timerEvent( QTimerEvent *event ); 106 void timerEvent( QTimerEvent *event );
107 void closeEvent( QCloseEvent *event ); 107 void closeEvent( QCloseEvent *event );
108 void keyReleaseEvent( QKeyEvent *e); 108 void keyReleaseEvent( QKeyEvent *e);
109private slots: 109private slots:
110 void skipFor(); 110 void skipFor();
111 void skipBack(); 111 void skipBack();
112 void stopSkip(); 112 void stopSkip();
113private: 113private:
114 void toggleButton( int ); 114 void toggleButton( int );
115 void setToggleButton( int, bool ); 115 void setToggleButton( int, bool );
116 void paintButton( QPainter *p, int i ); 116 void paintButton( QPainter *p, int i );
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
@@ -12,111 +12,119 @@
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34// this file is based on work by trolltech 34// this file is based on work by trolltech
35 35
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37#include <qpe/qlibrary.h> 37#include <qpe/qlibrary.h>
38#include <qpe/config.h> 38#include <qpe/config.h>
39#include <qvaluelist.h> 39#include <qvaluelist.h>
40#include <qobject.h> 40#include <qobject.h>
41#include <qdir.h> 41#include <qdir.h>
42#include "mediaplayerstate.h" 42#include "mediaplayerstate.h"
43 43
44 44#include <assert.h>
45 45
46//#define MediaPlayerDebug(x) qDebug x 46//#define MediaPlayerDebug(x) qDebug x
47#define MediaPlayerDebug(x) 47#define MediaPlayerDebug(x)
48 48
49 49
50MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) 50MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
51 : QObject( parent, name ) { 51 : QObject( parent, name ) {
52 Config cfg( "OpiePlayer" ); 52 Config cfg( "OpiePlayer" );
53 readConfig( cfg ); 53 readConfig( cfg );
54 streaming = false; 54 streaming = false;
55 seekable = true; 55 seekable = true;
56} 56}
57 57
58 58
59MediaPlayerState::~MediaPlayerState() { 59MediaPlayerState::~MediaPlayerState() {
60} 60}
61 61
62 62
63void MediaPlayerState::readConfig( Config& cfg ) { 63void MediaPlayerState::readConfig( Config& cfg ) {
64 cfg.setGroup("Options"); 64 cfg.setGroup("Options");
65 fullscreen = cfg.readBoolEntry( "FullScreen" ); 65 fullscreen = cfg.readBoolEntry( "FullScreen" );
66 scaled = cfg.readBoolEntry( "Scaling" ); 66 scaled = cfg.readBoolEntry( "Scaling" );
67 looping = cfg.readBoolEntry( "Looping" ); 67 looping = cfg.readBoolEntry( "Looping" );
68 shuffled = cfg.readBoolEntry( "Shuffle" ); 68 shuffled = cfg.readBoolEntry( "Shuffle" );
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 curView = 'l';
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::MediaType MediaPlayerState::mediaType() const 88MediaPlayerState::DisplayType MediaPlayerState::displayType() const
89{ 89{
90 return view() == 'a' ? MediaPlayerState::Audio : MediaPlayerState::Video; 90 char v = view();
91 switch ( v ) {
92 case 'a': return MediaPlayerState::Audio;
93 case 'v': return MediaPlayerState::Video;
94 case 'l': return MediaPlayerState::MediaSelection;
95 default: assert( false );
96 }
97 // never reached
98 return MediaPlayerState::MediaSelection;
91} 99}
92 100
93// slots 101// slots
94void MediaPlayerState::setIsStreaming( bool b ) { 102void MediaPlayerState::setIsStreaming( bool b ) {
95 streaming = b; 103 streaming = b;
96} 104}
97 105
98void MediaPlayerState::setIsSeekable( bool b ) { 106void MediaPlayerState::setIsSeekable( bool b ) {
99 seekable = b; 107 seekable = b;
100 emit isSeekableToggled(b); 108 emit isSeekableToggled(b);
101} 109}
102 110
103 111
104void MediaPlayerState::setFullscreen( bool b ) { 112void MediaPlayerState::setFullscreen( bool b ) {
105 if ( fullscreen == b ) { 113 if ( fullscreen == b ) {
106 return; 114 return;
107 } 115 }
108 fullscreen = b; 116 fullscreen = b;
109 emit fullscreenToggled(b); 117 emit fullscreenToggled(b);
110} 118}
111 119
112 120
113void MediaPlayerState::setBlanked( bool b ) { 121void MediaPlayerState::setBlanked( bool b ) {
114 if ( blanked == b ) { 122 if ( blanked == b ) {
115 return; 123 return;
116 } 124 }
117 blanked = b; 125 blanked = b;
118 emit blankToggled(b); 126 emit blankToggled(b);
119} 127}
120 128
121 129
122void MediaPlayerState::setScaled( bool b ) { 130void MediaPlayerState::setScaled( bool b ) {
@@ -179,65 +187,65 @@ void MediaPlayerState::setPosition( long p ) {
179} 187}
180 188
181void MediaPlayerState::updatePosition( long p ){ 189void MediaPlayerState::updatePosition( long p ){
182 if ( curPosition == p ) { 190 if ( curPosition == p ) {
183 return; 191 return;
184 } 192 }
185 curPosition = p; 193 curPosition = p;
186 emit positionUpdated(p); 194 emit positionUpdated(p);
187} 195}
188 196
189void MediaPlayerState::setVideoGamma( int v ){ 197void MediaPlayerState::setVideoGamma( int v ){
190 if ( videoGamma == v ) { 198 if ( videoGamma == v ) {
191 return; 199 return;
192 } 200 }
193 videoGamma = v; 201 videoGamma = v;
194 emit videoGammaChanged( v ); 202 emit videoGammaChanged( v );
195} 203}
196 204
197void MediaPlayerState::setLength( long l ) { 205void MediaPlayerState::setLength( long l ) {
198 if ( curLength == l ) { 206 if ( curLength == l ) {
199 return; 207 return;
200 } 208 }
201 curLength = l; 209 curLength = l;
202 emit lengthChanged(l); 210 emit lengthChanged(l);
203} 211}
204 212
205void MediaPlayerState::setView( char v ) { 213void MediaPlayerState::setView( char v ) {
206 if ( curView == v ) { 214 if ( curView == v ) {
207 return; 215 return;
208 } 216 }
209 curView = v; 217 curView = v;
210 emit viewChanged(v); 218 emit viewChanged(v);
211 emit mediaTypeChanged( mediaType() ); 219 emit displayTypeChanged( displayType() );
212} 220}
213 221
214void MediaPlayerState::setPrev(){ 222void MediaPlayerState::setPrev(){
215 emit prev(); 223 emit prev();
216} 224}
217 225
218void MediaPlayerState::setNext() { 226void MediaPlayerState::setNext() {
219 emit next(); 227 emit next();
220} 228}
221 229
222void MediaPlayerState::setList() { 230void MediaPlayerState::setList() {
223 setPlaying( FALSE ); 231 setPlaying( FALSE );
224 setView('l'); 232 setView('l');
225} 233}
226 234
227void MediaPlayerState::setVideo() { 235void MediaPlayerState::setVideo() {
228 setView('v'); 236 setView('v');
229} 237}
230 238
231void MediaPlayerState::setAudio() { 239void MediaPlayerState::setAudio() {
232 setView('a'); 240 setView('a');
233} 241}
234 242
235void MediaPlayerState::toggleFullscreen() { 243void MediaPlayerState::toggleFullscreen() {
236 setFullscreen( !fullscreen ); 244 setFullscreen( !fullscreen );
237} 245}
238 246
239void MediaPlayerState::toggleScaled() { 247void MediaPlayerState::toggleScaled() {
240 setScaled( !scaled); 248 setScaled( !scaled);
241} 249}
242 250
243void MediaPlayerState::toggleLooping() { 251void MediaPlayerState::toggleLooping() {
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h
index 05264cf..ca531c5 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.h
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h
@@ -18,126 +18,126 @@
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34// this file is based on work by trolltech 34// this file is based on work by trolltech
35 35
36#ifndef MEDIA_PLAYER_STATE_H 36#ifndef MEDIA_PLAYER_STATE_H
37#define MEDIA_PLAYER_STATE_H 37#define MEDIA_PLAYER_STATE_H
38 38
39 39
40#include <qobject.h> 40#include <qobject.h>
41 41
42 42
43class MediaPlayerDecoder; 43class MediaPlayerDecoder;
44class Config; 44class Config;
45 45
46 46
47class MediaPlayerState : public QObject { 47class MediaPlayerState : public QObject {
48Q_OBJECT 48Q_OBJECT
49public: 49public:
50 enum MediaType { Audio, Video }; 50 enum DisplayType { Audio, Video, MediaSelection };
51 51
52 MediaPlayerState( QObject *parent, const char *name ); 52 MediaPlayerState( QObject *parent, const char *name );
53 ~MediaPlayerState(); 53 ~MediaPlayerState();
54 54
55 bool isStreaming() const { return streaming; } 55 bool isStreaming() const { return streaming; }
56 bool isSeekable() const { return seekable; } 56 bool isSeekable() const { return seekable; }
57 bool isFullscreen() const { return fullscreen; } 57 bool isFullscreen() const { return fullscreen; }
58 bool isScaled() const { return scaled; } 58 bool isScaled() const { return scaled; }
59 bool isLooping() const { return looping; } 59 bool isLooping() const { return looping; }
60 bool isShuffled() const { return shuffled; } 60 bool isShuffled() const { return shuffled; }
61 bool isPaused() const { return paused; } 61 bool isPaused() const { return paused; }
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 { return curView; }
67 MediaType mediaType() const; 67 DisplayType displayType() const;
68 68
69public slots: 69public slots:
70 void setIsStreaming( bool b ); 70 void setIsStreaming( bool b );
71 void setIsSeekable( bool b ); 71 void setIsSeekable( bool b );
72 void setFullscreen( bool b ); 72 void setFullscreen( bool b );
73 void setScaled( bool b ); 73 void setScaled( bool b );
74 void setLooping( bool b ); 74 void setLooping( bool b );
75 void setShuffled( bool b ); 75 void setShuffled( bool b );
76 void setPaused( bool b ); 76 void setPaused( bool b );
77 void setPlaying( bool b ); 77 void setPlaying( bool b );
78 void setStopped( bool b ); 78 void setStopped( bool b );
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 setBlanked( bool b ); 83 void setBlanked( bool b );
84 void setVideoGamma( int v ); 84 void setVideoGamma( int v );
85 85
86 void setPrev(); 86 void setPrev();
87 void setNext(); 87 void setNext();
88 void setList(); 88 void setList();
89 void setVideo(); 89 void setVideo();
90 void setAudio(); 90 void setAudio();
91 91
92 void toggleFullscreen(); 92 void toggleFullscreen();
93 void toggleScaled(); 93 void toggleScaled();
94 void toggleLooping(); 94 void toggleLooping();
95 void toggleShuffled(); 95 void toggleShuffled();
96 void togglePaused(); 96 void togglePaused();
97 void togglePlaying(); 97 void togglePlaying();
98 void toggleBlank(); 98 void toggleBlank();
99 void writeConfig( Config& cfg ) const; 99 void writeConfig( Config& cfg ) const;
100 100
101 101
102signals: 102signals:
103 void fullscreenToggled( bool ); 103 void fullscreenToggled( bool );
104 void scaledToggled( bool ); 104 void scaledToggled( bool );
105 void loopingToggled( bool ); 105 void loopingToggled( bool );
106 void shuffledToggled( bool ); 106 void shuffledToggled( bool );
107 void pausedToggled( bool ); 107 void pausedToggled( bool );
108 void playingToggled( bool ); 108 void playingToggled( bool );
109 void stopToggled( bool ); 109 void stopToggled( bool );
110 void positionChanged( long ); // When the slider is moved 110 void positionChanged( long ); // When the slider is moved
111 void positionUpdated( long ); // When the media file progresses 111 void positionUpdated( long ); // When the media file progresses
112 void lengthChanged( long ); 112 void lengthChanged( long );
113 void viewChanged( char ); 113 void viewChanged( char );
114 void mediaTypeChanged( MediaPlayerState::MediaType 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 );
118 void prev(); 118 void prev();
119 void next(); 119 void next();
120 120
121private: 121private:
122 bool streaming : 1; 122 bool streaming : 1;
123 bool seekable : 1; 123 bool seekable : 1;
124 bool fullscreen: 1; 124 bool fullscreen: 1;
125 bool scaled : 1; 125 bool scaled : 1;
126 bool blanked : 1; 126 bool blanked : 1;
127 bool looping : 1; 127 bool looping : 1;
128 bool shuffled : 1; 128 bool shuffled : 1;
129 bool usePlaylist : 1; 129 bool usePlaylist : 1;
130 bool paused : 1; 130 bool paused : 1;
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 char curView;
136 int videoGamma; 136 int videoGamma;
137 void readConfig( Config& cfg ); 137 void readConfig( Config& cfg );
138 138
139}; 139};
140 140
141 141
142#endif // MEDIA_PLAYER_STATE_H 142#endif // MEDIA_PLAYER_STATE_H
143 143