-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 9 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 36 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 2 |
5 files changed, 30 insertions, 19 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 00d516c..de91a59 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -160,67 +160,64 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
160 | uchar *line = dest[y]; | 160 | uchar *line = dest[y]; |
161 | for ( int x = 0; x < imgUp->width(); x++ ) | 161 | for ( int x = 0; x < imgUp->width(); x++ ) |
162 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 162 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
163 | line[x] = i + 1; | 163 | line[x] = i + 1; |
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | } | 167 | } |
168 | 168 | ||
169 | for ( int i = 0; i < 10; i++ ) { | 169 | for ( int i = 0; i < 10; i++ ) { |
170 | buttonPixUp[i] = 0l; | 170 | buttonPixUp[i] = 0l; |
171 | buttonPixDown[i] = 0l; | 171 | buttonPixDown[i] = 0l; |
172 | } | 172 | } |
173 | 173 | ||
174 | setBackgroundPixmap( *pixBg ); | 174 | setBackgroundPixmap( *pixBg ); |
175 | 175 | ||
176 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 176 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
177 | changeTextColor( &songInfo ); | 177 | changeTextColor( &songInfo ); |
178 | 178 | ||
179 | slider.setFixedHeight( 20 ); | 179 | slider.setFixedHeight( 20 ); |
180 | slider.setMinValue( 0 ); | 180 | slider.setMinValue( 0 ); |
181 | slider.setMaxValue( 1 ); | 181 | slider.setMaxValue( 1 ); |
182 | slider.setFocusPolicy( QWidget::NoFocus ); | 182 | slider.setFocusPolicy( QWidget::NoFocus ); |
183 | slider.setBackgroundPixmap( *pixBg ); | 183 | slider.setBackgroundPixmap( *pixBg ); |
184 | 184 | ||
185 | time.setFocusPolicy( QWidget::NoFocus ); | 185 | time.setFocusPolicy( QWidget::NoFocus ); |
186 | time.setAlignment( Qt::AlignCenter ); | 186 | time.setAlignment( Qt::AlignCenter ); |
187 | time.setFrame(FALSE); | 187 | time.setFrame(FALSE); |
188 | changeTextColor( &time ); | 188 | changeTextColor( &time ); |
189 | 189 | ||
190 | resizeEvent( NULL ); | 190 | resizeEvent( NULL ); |
191 | 191 | ||
192 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | ||
193 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | ||
194 | |||
195 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 192 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
196 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 193 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
197 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 194 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
198 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 195 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
199 | connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); | 196 | connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); |
200 | 197 | ||
201 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | 198 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); |
202 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); | 199 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); |
203 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); | 200 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); |
204 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); | 201 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); |
205 | 202 | ||
206 | // Intialise state | 203 | // Intialise state |
207 | setLength( mediaPlayerState->length() ); | 204 | setLength( mediaPlayerState->length() ); |
208 | setPosition( mediaPlayerState->position() ); | 205 | setPosition( mediaPlayerState->position() ); |
209 | setLooping( mediaPlayerState->fullscreen() ); | 206 | setLooping( mediaPlayerState->fullscreen() ); |
210 | // setPaused( mediaPlayerState->paused() ); | 207 | // setPaused( mediaPlayerState->paused() ); |
211 | setPlaying( mediaPlayerState->playing() ); | 208 | setPlaying( mediaPlayerState->playing() ); |
212 | 209 | ||
213 | } | 210 | } |
214 | 211 | ||
215 | AudioWidget::~AudioWidget() { | 212 | AudioWidget::~AudioWidget() { |
216 | 213 | ||
217 | for ( int i = 0; i < 10; i++ ) { | 214 | for ( int i = 0; i < 10; i++ ) { |
218 | delete buttonPixUp[i]; | 215 | delete buttonPixUp[i]; |
219 | delete buttonPixDown[i]; | 216 | delete buttonPixDown[i]; |
220 | } | 217 | } |
221 | delete pixBg; | 218 | delete pixBg; |
222 | delete imgUp; | 219 | delete imgUp; |
223 | delete imgDn; | 220 | delete imgDn; |
224 | delete imgButtonMask; | 221 | delete imgButtonMask; |
225 | for ( int i = 0; i < 10; i++ ) { | 222 | for ( int i = 0; i < 10; i++ ) { |
226 | delete masks[i]; | 223 | delete masks[i]; |
@@ -290,78 +287,82 @@ void AudioWidget::sliderReleased() { | |||
290 | if ( slider.width() == 0 ) | 287 | if ( slider.width() == 0 ) |
291 | return; | 288 | return; |
292 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); | 289 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); |
293 | mediaPlayerState->setPosition( val ); | 290 | mediaPlayerState->setPosition( val ); |
294 | } | 291 | } |
295 | 292 | ||
296 | void AudioWidget::setPosition( long i ) { | 293 | void AudioWidget::setPosition( long i ) { |
297 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); | 294 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); |
298 | updateSlider( i, mediaPlayerState->length() ); | 295 | updateSlider( i, mediaPlayerState->length() ); |
299 | } | 296 | } |
300 | 297 | ||
301 | 298 | ||
302 | void AudioWidget::setLength( long max ) { | 299 | void AudioWidget::setLength( long max ) { |
303 | updateSlider( mediaPlayerState->position(), max ); | 300 | updateSlider( mediaPlayerState->position(), max ); |
304 | } | 301 | } |
305 | 302 | ||
306 | 303 | ||
307 | void AudioWidget::setView( char view ) { | 304 | void AudioWidget::setView( char view ) { |
308 | 305 | ||
309 | if ( view == 'a' ) { | 306 | if ( view == 'a' ) { |
310 | // startTimer( 150 ); | 307 | // startTimer( 150 ); |
311 | showMaximized(); | 308 | showMaximized(); |
312 | } else { | 309 | } else { |
313 | killTimers(); | 310 | killTimers(); |
314 | hide(); | 311 | hide(); |
315 | } | 312 | } |
316 | // qApp->processEvents(); | 313 | // qApp->processEvents(); |
317 | } | 314 | } |
318 | 315 | ||
319 | 316 | ||
320 | void AudioWidget::setSeekable( bool isSeekable ) { | 317 | void AudioWidget::setSeekable( bool isSeekable ) { |
321 | 318 | ||
322 | if ( isSeekable ) { | 319 | if ( !isSeekable ) { |
323 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); | 320 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); |
324 | if( !slider.isHidden()) { | 321 | if( !slider.isHidden()) { |
325 | slider.hide(); | 322 | slider.hide(); |
326 | } | 323 | } |
327 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 324 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
328 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 325 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
326 | disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | ||
327 | disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | ||
329 | } else { | 328 | } else { |
330 | // this stops the slider from being moved, thus | 329 | // this stops the slider from being moved, thus |
331 | // does not stop stream when it reaches the end | 330 | // does not stop stream when it reaches the end |
332 | slider.show(); | 331 | slider.show(); |
333 | qDebug( " CONNECT SET POSTION " ); | 332 | qDebug( " CONNECT SET POSTION " ); |
334 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 333 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
335 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 334 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
335 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | ||
336 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | ||
336 | } | 337 | } |
337 | } | 338 | } |
338 | 339 | ||
339 | 340 | ||
340 | static QString timeAsString( long length ) { | 341 | static QString timeAsString( long length ) { |
341 | int minutes = length / 60; | 342 | int minutes = length / 60; |
342 | int seconds = length % 60; | 343 | int seconds = length % 60; |
343 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); | 344 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); |
344 | } | 345 | } |
345 | 346 | ||
346 | void AudioWidget::updateSlider( long i, long max ) { | 347 | void AudioWidget::updateSlider( long i, long max ) { |
347 | 348 | ||
348 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); | 349 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); |
349 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; | 350 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; |
350 | 351 | ||
351 | if ( max == 0 ) { | 352 | if ( max == 0 ) { |
352 | return; | 353 | return; |
353 | } | 354 | } |
354 | // Will flicker too much if we don't do this | 355 | // Will flicker too much if we don't do this |
355 | // Scale to something reasonable | 356 | // Scale to something reasonable |
356 | int width = slider.width(); | 357 | int width = slider.width(); |
357 | int val = int((double)i * width / max); | 358 | int val = int((double)i * width / max); |
358 | if ( !audioSliderBeingMoved ) { | 359 | if ( !audioSliderBeingMoved ) { |
359 | if ( slider.value() != val ) { | 360 | if ( slider.value() != val ) { |
360 | slider.setValue( val ); | 361 | slider.setValue( val ); |
361 | } | 362 | } |
362 | 363 | ||
363 | if ( slider.maxValue() != width ) { | 364 | if ( slider.maxValue() != width ) { |
364 | slider.setMaxValue( width ); | 365 | slider.setMaxValue( width ); |
365 | } | 366 | } |
366 | } | 367 | } |
367 | } | 368 | } |
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 09dc19b..bcd941e 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -60,65 +60,64 @@ enum AudioButtons { | |||
60 | AudioForward, | 60 | AudioForward, |
61 | AudioBack | 61 | AudioBack |
62 | }; | 62 | }; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | class Ticker : public QFrame { | 65 | class Ticker : public QFrame { |
66 | Q_OBJECT | 66 | Q_OBJECT |
67 | 67 | ||
68 | public: | 68 | public: |
69 | Ticker( QWidget* parent=0 ); | 69 | Ticker( QWidget* parent=0 ); |
70 | ~Ticker(); | 70 | ~Ticker(); |
71 | void setText( const QString& text ) ; | 71 | void setText( const QString& text ) ; |
72 | 72 | ||
73 | protected: | 73 | protected: |
74 | void timerEvent( QTimerEvent * ); | 74 | void timerEvent( QTimerEvent * ); |
75 | void drawContents( QPainter *p ); | 75 | void drawContents( QPainter *p ); |
76 | private: | 76 | private: |
77 | QString scrollText; | 77 | QString scrollText; |
78 | int pos, pixelLen; | 78 | int pos, pixelLen; |
79 | }; | 79 | }; |
80 | 80 | ||
81 | 81 | ||
82 | class AudioWidget : public QWidget { | 82 | class AudioWidget : public QWidget { |
83 | Q_OBJECT | 83 | Q_OBJECT |
84 | public: | 84 | public: |
85 | AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 85 | AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
86 | ~AudioWidget(); | 86 | ~AudioWidget(); |
87 | void setTickerText( const QString &text ) { songInfo.setText( text ); } | 87 | void setTickerText( const QString &text ) { songInfo.setText( text ); } |
88 | public slots: | 88 | public slots: |
89 | void updateSlider( long, long ); | 89 | void updateSlider( long, long ); |
90 | void sliderPressed( ); | 90 | void sliderPressed( ); |
91 | void sliderReleased( ); | 91 | void sliderReleased( ); |
92 | // void setPaused( bool b) { setToggleButton( AudioPause, b ); } | ||
93 | void setLooping( bool b) { setToggleButton( AudioLoop, b ); } | 92 | void setLooping( bool b) { setToggleButton( AudioLoop, b ); } |
94 | void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } | 93 | void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } |
95 | void setPosition( long ); | 94 | void setPosition( long ); |
96 | void setLength( long ); | 95 | void setLength( long ); |
97 | void setSeekable( bool ); | 96 | void setSeekable( bool ); |
98 | void setView( char ); | 97 | void setView( char ); |
99 | 98 | ||
100 | signals: | 99 | signals: |
101 | void moreClicked(); | 100 | void moreClicked(); |
102 | void lessClicked(); | 101 | void lessClicked(); |
103 | void moreReleased(); | 102 | void moreReleased(); |
104 | void lessReleased(); | 103 | void lessReleased(); |
105 | void forwardClicked(); | 104 | void forwardClicked(); |
106 | void backClicked(); | 105 | void backClicked(); |
107 | void forwardReleased(); | 106 | void forwardReleased(); |
108 | void backReleased(); | 107 | void backReleased(); |
109 | void sliderMoved(long); | 108 | void sliderMoved(long); |
110 | 109 | ||
111 | protected: | 110 | protected: |
112 | void doBlank(); | 111 | void doBlank(); |
113 | void doUnblank(); | 112 | void doUnblank(); |
114 | void paintEvent( QPaintEvent *pe ); | 113 | void paintEvent( QPaintEvent *pe ); |
115 | void showEvent( QShowEvent *se ); | 114 | void showEvent( QShowEvent *se ); |
116 | void resizeEvent( QResizeEvent *re ); | 115 | void resizeEvent( QResizeEvent *re ); |
117 | void mouseMoveEvent( QMouseEvent *event ); | 116 | void mouseMoveEvent( QMouseEvent *event ); |
118 | void mousePressEvent( QMouseEvent *event ); | 117 | void mousePressEvent( QMouseEvent *event ); |
119 | void mouseReleaseEvent( QMouseEvent *event ); | 118 | void mouseReleaseEvent( QMouseEvent *event ); |
120 | void timerEvent( QTimerEvent *event ); | 119 | void timerEvent( QTimerEvent *event ); |
121 | void closeEvent( QCloseEvent *event ); | 120 | void closeEvent( QCloseEvent *event ); |
122 | void keyReleaseEvent( QKeyEvent *e); | 121 | void keyReleaseEvent( QKeyEvent *e); |
123 | private slots: | 122 | private slots: |
124 | void skipFor(); | 123 | void skipFor(); |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 7d71d09..a847605 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -109,69 +109,68 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | |||
109 | for ( int i = 0; i < 7; i++ ) { | 109 | for ( int i = 0; i < 7; i++ ) { |
110 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); | 110 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); |
111 | masks[i] = new QBitmap( filename ); | 111 | masks[i] = new QBitmap( filename ); |
112 | 112 | ||
113 | if ( !masks[i]->isNull() ) { | 113 | if ( !masks[i]->isNull() ) { |
114 | QImage imgMask = masks[i]->convertToImage(); | 114 | QImage imgMask = masks[i]->convertToImage(); |
115 | uchar **dest = imgButtonMask->jumpTable(); | 115 | uchar **dest = imgButtonMask->jumpTable(); |
116 | for ( int y = 0; y < imgUp->height(); y++ ) { | 116 | for ( int y = 0; y < imgUp->height(); y++ ) { |
117 | uchar *line = dest[y]; | 117 | uchar *line = dest[y]; |
118 | for ( int x = 0; x < imgUp->width(); x++ ) { | 118 | for ( int x = 0; x < imgUp->width(); x++ ) { |
119 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 119 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
120 | line[x] = i + 1; | 120 | line[x] = i + 1; |
121 | } | 121 | } |
122 | } | 122 | } |
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||
126 | for ( int i = 0; i < 7; i++ ) { | 126 | for ( int i = 0; i < 7; i++ ) { |
127 | buttonPixUp[i] = NULL; | 127 | buttonPixUp[i] = NULL; |
128 | buttonPixDown[i] = NULL; | 128 | buttonPixDown[i] = NULL; |
129 | } | 129 | } |
130 | 130 | ||
131 | setBackgroundPixmap( *pixBg ); | 131 | setBackgroundPixmap( *pixBg ); |
132 | 132 | ||
133 | slider = new QSlider( Qt::Horizontal, this ); | 133 | slider = new QSlider( Qt::Horizontal, this ); |
134 | slider->setMinValue( 0 ); | 134 | slider->setMinValue( 0 ); |
135 | slider->setMaxValue( 1 ); | 135 | slider->setMaxValue( 1 ); |
136 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 136 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
137 | //slider->setFocusPolicy( QWidget::NoFocus ); | 137 | //slider->setFocusPolicy( QWidget::NoFocus ); |
138 | 138 | ||
139 | resizeEvent( NULL ); | 139 | resizeEvent( NULL ); |
140 | 140 | ||
141 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | ||
142 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | ||
143 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 141 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
144 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 142 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
145 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 143 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
144 | connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); | ||
146 | 145 | ||
147 | setLength( mediaPlayerState->length() ); | 146 | setLength( mediaPlayerState->length() ); |
148 | setPosition( mediaPlayerState->position() ); | 147 | setPosition( mediaPlayerState->position() ); |
149 | setFullscreen( mediaPlayerState->fullscreen() ); | 148 | setFullscreen( mediaPlayerState->fullscreen() ); |
150 | setPlaying( mediaPlayerState->playing() ); | 149 | setPlaying( mediaPlayerState->playing() ); |
151 | } | 150 | } |
152 | 151 | ||
153 | 152 | ||
154 | VideoWidget::~VideoWidget() { | 153 | VideoWidget::~VideoWidget() { |
155 | 154 | ||
156 | for ( int i = 0; i < 7; i++ ) { | 155 | for ( int i = 0; i < 7; i++ ) { |
157 | delete buttonPixUp[i]; | 156 | delete buttonPixUp[i]; |
158 | delete buttonPixDown[i]; | 157 | delete buttonPixDown[i]; |
159 | } | 158 | } |
160 | 159 | ||
161 | delete pixBg; | 160 | delete pixBg; |
162 | delete imgUp; | 161 | delete imgUp; |
163 | delete imgDn; | 162 | delete imgDn; |
164 | delete imgButtonMask; | 163 | delete imgButtonMask; |
165 | for ( int i = 0; i < 7; i++ ) { | 164 | for ( int i = 0; i < 7; i++ ) { |
166 | delete masks[i]; | 165 | delete masks[i]; |
167 | } | 166 | } |
168 | 167 | ||
169 | } | 168 | } |
170 | 169 | ||
171 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 170 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
172 | QPixmap pix( img.width(), img.height() ); | 171 | QPixmap pix( img.width(), img.height() ); |
173 | QPainter p( &pix ); | 172 | QPainter p( &pix ); |
174 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 173 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
175 | p.drawImage( 0, 0, img ); | 174 | p.drawImage( 0, 0, img ); |
176 | return new QPixmap( pix ); | 175 | return new QPixmap( pix ); |
177 | } | 176 | } |
@@ -359,84 +358,95 @@ void VideoWidget::mousePressEvent( QMouseEvent *event ) { | |||
359 | } | 358 | } |
360 | 359 | ||
361 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 360 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
362 | if ( mediaPlayerState->fullscreen() ) { | 361 | if ( mediaPlayerState->fullscreen() ) { |
363 | mediaPlayerState->setFullscreen( FALSE ); | 362 | mediaPlayerState->setFullscreen( FALSE ); |
364 | makeVisible(); | 363 | makeVisible(); |
365 | } | 364 | } |
366 | mouseMoveEvent( event ); | 365 | mouseMoveEvent( event ); |
367 | } | 366 | } |
368 | 367 | ||
369 | void VideoWidget::showEvent( QShowEvent* ) { | 368 | void VideoWidget::showEvent( QShowEvent* ) { |
370 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 369 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
371 | mouseMoveEvent( &event ); | 370 | mouseMoveEvent( &event ); |
372 | } | 371 | } |
373 | 372 | ||
374 | 373 | ||
375 | void VideoWidget::backToNormal() { | 374 | void VideoWidget::backToNormal() { |
376 | mediaPlayerState->setFullscreen( FALSE ); | 375 | mediaPlayerState->setFullscreen( FALSE ); |
377 | makeVisible(); | 376 | makeVisible(); |
378 | } | 377 | } |
379 | 378 | ||
380 | void VideoWidget::makeVisible() { | 379 | void VideoWidget::makeVisible() { |
381 | if ( mediaPlayerState->fullscreen() ) { | 380 | if ( mediaPlayerState->fullscreen() ) { |
382 | setBackgroundMode( QWidget::NoBackground ); | 381 | setBackgroundMode( QWidget::NoBackground ); |
383 | showFullScreen(); | 382 | showFullScreen(); |
384 | resize( qApp->desktop()->size() ); | 383 | resize( qApp->desktop()->size() ); |
385 | slider->hide(); | 384 | slider->hide(); |
386 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 385 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
387 | } else { | 386 | } else { |
388 | showNormal(); | 387 | showNormal(); |
389 | showMaximized(); | 388 | showMaximized(); |
390 | setBackgroundPixmap( *pixBg ); | 389 | setBackgroundPixmap( *pixBg ); |
391 | if ( mediaPlayerState->seekable() ) { | ||
392 | slider->hide(); | ||
393 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | ||
394 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | ||
395 | } else { | ||
396 | slider->show(); | ||
397 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | ||
398 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | ||
399 | } | ||
400 | QWidget *d = QApplication::desktop(); | 390 | QWidget *d = QApplication::desktop(); |
401 | int w = d->width(); | 391 | int w = d->width(); |
402 | int h = d->height(); | 392 | int h = d->height(); |
403 | 393 | ||
404 | if(w>h) { | 394 | if(w>h) { |
405 | int newW=(w/2)-(246/2); //this will only work with 320x240 | 395 | int newW=(w/2)-(246/2); //this will only work with 320x240 |
406 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); | 396 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); |
407 | } else | 397 | } else { |
408 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); | 398 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); |
399 | } | ||
400 | } | ||
401 | } | ||
402 | |||
403 | |||
404 | void VideoWidget::setSeekable( bool isSeekable ) { | ||
409 | 405 | ||
410 | // qApp->processEvents(); | 406 | if ( !isSeekable || mediaPlayerState->fullscreen() ) { |
407 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); | ||
408 | if( !slider->isHidden()) { | ||
409 | slider->hide(); | ||
410 | } | ||
411 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | ||
412 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | ||
413 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | ||
414 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | ||
415 | } else { | ||
416 | slider->show(); | ||
417 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | ||
418 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | ||
419 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | ||
420 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | ||
411 | } | 421 | } |
412 | } | 422 | } |
413 | 423 | ||
414 | 424 | ||
415 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 425 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
416 | QPainter p( this ); | 426 | QPainter p( this ); |
417 | 427 | ||
418 | if ( mediaPlayerState->fullscreen() ) { | 428 | if ( mediaPlayerState->fullscreen() ) { |
419 | // Clear the background | 429 | // Clear the background |
420 | p.setBrush( QBrush( Qt::black ) ); | 430 | p.setBrush( QBrush( Qt::black ) ); |
421 | } else { | 431 | } else { |
422 | if ( !pe->erased() ) { | 432 | if ( !pe->erased() ) { |
423 | // Combine with background and double buffer | 433 | // Combine with background and double buffer |
424 | QPixmap pix( pe->rect().size() ); | 434 | QPixmap pix( pe->rect().size() ); |
425 | QPainter p( &pix ); | 435 | QPainter p( &pix ); |
426 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 436 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
427 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 437 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |
428 | for ( int i = 0; i < numVButtons; i++ ) { | 438 | for ( int i = 0; i < numVButtons; i++ ) { |
429 | paintButton( &p, i ); | 439 | paintButton( &p, i ); |
430 | } | 440 | } |
431 | QPainter p2( this ); | 441 | QPainter p2( this ); |
432 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 442 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
433 | } else { | 443 | } else { |
434 | QPainter p( this ); | 444 | QPainter p( this ); |
435 | for ( int i = 0; i < numVButtons; i++ ) | 445 | for ( int i = 0; i < numVButtons; i++ ) |
436 | paintButton( &p, i ); | 446 | paintButton( &p, i ); |
437 | } | 447 | } |
438 | //slider->repaint( TRUE ); | 448 | //slider->repaint( TRUE ); |
439 | } | 449 | } |
440 | } | 450 | } |
441 | 451 | ||
442 | 452 | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 990fa5f..fd02805 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -40,64 +40,65 @@ | |||
40 | class QPixmap; | 40 | class QPixmap; |
41 | class QSlider; | 41 | class QSlider; |
42 | 42 | ||
43 | enum VideoButtons { | 43 | enum VideoButtons { |
44 | VideoStop = 0, | 44 | VideoStop = 0, |
45 | VideoPlay, | 45 | VideoPlay, |
46 | // VideoPause, | 46 | // VideoPause, |
47 | VideoPrevious, | 47 | VideoPrevious, |
48 | VideoNext, | 48 | VideoNext, |
49 | VideoVolUp, | 49 | VideoVolUp, |
50 | VideoVolDown, | 50 | VideoVolDown, |
51 | VideoFullscreen | 51 | VideoFullscreen |
52 | }; | 52 | }; |
53 | 53 | ||
54 | class VideoWidget : public QWidget { | 54 | class VideoWidget : public QWidget { |
55 | Q_OBJECT | 55 | Q_OBJECT |
56 | public: | 56 | public: |
57 | VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 57 | VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
58 | ~VideoWidget(); | 58 | ~VideoWidget(); |
59 | 59 | ||
60 | 60 | ||
61 | XineVideoWidget* vidWidget(); | 61 | XineVideoWidget* vidWidget(); |
62 | public slots: | 62 | public slots: |
63 | void updateSlider( long, long ); | 63 | void updateSlider( long, long ); |
64 | void sliderPressed( ); | 64 | void sliderPressed( ); |
65 | void sliderReleased( ); | 65 | void sliderReleased( ); |
66 | void setPlaying( bool b); | 66 | void setPlaying( bool b); |
67 | void setFullscreen( bool b ); | 67 | void setFullscreen( bool b ); |
68 | void makeVisible(); | 68 | void makeVisible(); |
69 | void backToNormal(); | 69 | void backToNormal(); |
70 | void setPosition( long ); | 70 | void setPosition( long ); |
71 | void setLength( long ); | 71 | void setLength( long ); |
72 | void setSeekable( bool ); | ||
72 | void setView( char ); | 73 | void setView( char ); |
73 | 74 | ||
74 | signals: | 75 | signals: |
75 | void moreClicked(); | 76 | void moreClicked(); |
76 | void lessClicked(); | 77 | void lessClicked(); |
77 | void moreReleased(); | 78 | void moreReleased(); |
78 | void lessReleased(); | 79 | void lessReleased(); |
79 | void sliderMoved( long ); | 80 | void sliderMoved( long ); |
80 | void videoResized ( const QSize &s ); | 81 | void videoResized ( const QSize &s ); |
81 | 82 | ||
82 | protected: | 83 | protected: |
83 | 84 | ||
84 | void resizeEvent( QResizeEvent * ); | 85 | void resizeEvent( QResizeEvent * ); |
85 | void paintEvent( QPaintEvent *pe ); | 86 | void paintEvent( QPaintEvent *pe ); |
86 | void showEvent( QShowEvent *se ); | 87 | void showEvent( QShowEvent *se ); |
87 | void mouseMoveEvent( QMouseEvent *event ); | 88 | void mouseMoveEvent( QMouseEvent *event ); |
88 | void mousePressEvent( QMouseEvent *event ); | 89 | void mousePressEvent( QMouseEvent *event ); |
89 | void mouseReleaseEvent( QMouseEvent *event ); | 90 | void mouseReleaseEvent( QMouseEvent *event ); |
90 | void closeEvent( QCloseEvent *event ); | 91 | void closeEvent( QCloseEvent *event ); |
91 | void keyReleaseEvent( QKeyEvent *e); | 92 | void keyReleaseEvent( QKeyEvent *e); |
92 | 93 | ||
93 | private: | 94 | private: |
94 | // Ticker songInfo; | 95 | // Ticker songInfo; |
95 | QPixmap *pixBg; | 96 | QPixmap *pixBg; |
96 | QImage *imgUp; | 97 | QImage *imgUp; |
97 | QImage *imgDn; | 98 | QImage *imgDn; |
98 | QImage *imgButtonMask; | 99 | QImage *imgButtonMask; |
99 | QBitmap *masks[7]; | 100 | QBitmap *masks[7]; |
100 | QPixmap *buttonPixUp[7]; | 101 | QPixmap *buttonPixUp[7]; |
101 | QPixmap *buttonPixDown[7]; | 102 | QPixmap *buttonPixDown[7]; |
102 | QString skin; | 103 | QString skin; |
103 | // QPixmap *pixmaps[4]; | 104 | // QPixmap *pixmaps[4]; |
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 65ac127..c46994a 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -70,65 +70,65 @@ XineControl::~XineControl() { | |||
70 | delete libXine; | 70 | delete libXine; |
71 | } | 71 | } |
72 | 72 | ||
73 | void XineControl::play( const QString& fileName ) { | 73 | void XineControl::play( const QString& fileName ) { |
74 | hasVideoChannel = FALSE; | 74 | hasVideoChannel = FALSE; |
75 | hasAudioChannel = FALSE; | 75 | hasAudioChannel = FALSE; |
76 | m_fileName = fileName; | 76 | m_fileName = fileName; |
77 | 77 | ||
78 | qDebug("<<FILENAME: " + fileName + ">>>>"); | 78 | qDebug("<<FILENAME: " + fileName + ">>>>"); |
79 | 79 | ||
80 | if ( !libXine->play( fileName, 0, 0 ) ) { | 80 | if ( !libXine->play( fileName, 0, 0 ) ) { |
81 | QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); | 81 | QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); |
82 | // toggle stop so the the play button is reset | 82 | // toggle stop so the the play button is reset |
83 | mediaPlayerState->setPlaying( false ); | 83 | mediaPlayerState->setPlaying( false ); |
84 | return; | 84 | return; |
85 | } | 85 | } |
86 | mediaPlayerState->setPlaying( true ); | 86 | mediaPlayerState->setPlaying( true ); |
87 | 87 | ||
88 | char whichGui; | 88 | char whichGui; |
89 | // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); | 89 | // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); |
90 | if ( !libXine->hasVideo() ) { | 90 | if ( !libXine->hasVideo() ) { |
91 | whichGui = 'a'; | 91 | whichGui = 'a'; |
92 | qDebug("HAS AUDIO"); | 92 | qDebug("HAS AUDIO"); |
93 | libXine->setShowVideo( false ); | 93 | libXine->setShowVideo( false ); |
94 | hasAudioChannel = TRUE; | 94 | hasAudioChannel = TRUE; |
95 | } else { | 95 | } else { |
96 | whichGui = 'v'; | 96 | whichGui = 'v'; |
97 | qDebug("HAS VIDEO"); | 97 | qDebug("HAS VIDEO"); |
98 | libXine->setShowVideo( true ); | 98 | libXine->setShowVideo( true ); |
99 | hasVideoChannel = TRUE; | 99 | hasVideoChannel = TRUE; |
100 | } | 100 | } |
101 | // determine if slider is shown | 101 | // determine if slider is shown |
102 | mediaPlayerState->setIsSeekable( !libXine->isSeekable() ); | 102 | mediaPlayerState->setIsSeekable( libXine->isSeekable() ); |
103 | 103 | ||
104 | // which gui (video / audio) | 104 | // which gui (video / audio) |
105 | mediaPlayerState->setView( whichGui ); | 105 | mediaPlayerState->setView( whichGui ); |
106 | 106 | ||
107 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 107 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
108 | if ( !disabledSuspendScreenSaver ) { | 108 | if ( !disabledSuspendScreenSaver ) { |
109 | disabledSuspendScreenSaver = TRUE; | 109 | disabledSuspendScreenSaver = TRUE; |
110 | // Stop the screen from blanking and power saving state | 110 | // Stop the screen from blanking and power saving state |
111 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) | 111 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) |
112 | << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); | 112 | << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); |
113 | } | 113 | } |
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | length(); | 116 | length(); |
117 | position(); | 117 | position(); |
118 | } | 118 | } |
119 | 119 | ||
120 | void XineControl::nextMedia() { | 120 | void XineControl::nextMedia() { |
121 | mediaPlayerState->setNext(); | 121 | mediaPlayerState->setNext(); |
122 | } | 122 | } |
123 | 123 | ||
124 | void XineControl::setGamma( int value ) { | 124 | void XineControl::setGamma( int value ) { |
125 | libXine->setGamma( value ); | 125 | libXine->setGamma( value ); |
126 | } | 126 | } |
127 | 127 | ||
128 | void XineControl::stop( bool isSet ) { | 128 | void XineControl::stop( bool isSet ) { |
129 | if ( !isSet ) { | 129 | if ( !isSet ) { |
130 | libXine->stop(); | 130 | libXine->stop(); |
131 | 131 | ||
132 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 132 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
133 | if ( disabledSuspendScreenSaver ) { | 133 | if ( disabledSuspendScreenSaver ) { |
134 | disabledSuspendScreenSaver = FALSE; | 134 | disabledSuspendScreenSaver = FALSE; |