summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-02 18:37:23 (UTC)
committer simon <simon>2002-12-02 18:37:23 (UTC)
commit54665278a9b7d703deb73ede0d74d3948c265b39 (patch) (unidiff)
tree82a047d0c948f8a1f917a8fb430a69dbf2968e25
parentcf6d2e032faac6fbaeb9c5730767fc25021045fe (diff)
downloadopie-54665278a9b7d703deb73ede0d74d3948c265b39.zip
opie-54665278a9b7d703deb73ede0d74d3948c265b39.tar.gz
opie-54665278a9b7d703deb73ede0d74d3948c265b39.tar.bz2
- converted to MediaPlayerState::DisplayType
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp19
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h4
2 files changed, 13 insertions, 10 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index ff3f5f7..9ce2b57 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -118,49 +118,49 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) {
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( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 141 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
142 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 142 connect( mediaPlayerState, SIGNAL( displayTypeChanged(MediaPlayerState::DisplayType) ), this, SLOT( setDisplayType(MediaPlayerState::DisplayType) ) );
143 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 143 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
144 144
145 setLength( mediaPlayerState->length() ); 145 setLength( mediaPlayerState->length() );
146 setPosition( mediaPlayerState->position() ); 146 setPosition( mediaPlayerState->position() );
147 setFullscreen( mediaPlayerState->isFullscreen() ); 147 setFullscreen( mediaPlayerState->isFullscreen() );
148 setPlaying( mediaPlayerState->isPlaying() ); 148 setPlaying( mediaPlayerState->isPlaying() );
149} 149}
150 150
151 151
152VideoWidget::~VideoWidget() { 152VideoWidget::~VideoWidget() {
153 153
154 for ( int i = 0; i < 7; i++ ) { 154 for ( int i = 0; i < 7; i++ ) {
155 delete buttonPixUp[i]; 155 delete buttonPixUp[i];
156 delete buttonPixDown[i]; 156 delete buttonPixDown[i];
157 } 157 }
158 158
159 delete pixBg; 159 delete pixBg;
160 delete imgUp; 160 delete imgUp;
161 delete imgDn; 161 delete imgDn;
162 delete imgButtonMask; 162 delete imgButtonMask;
163 for ( int i = 0; i < 7; i++ ) { 163 for ( int i = 0; i < 7; i++ ) {
164 delete masks[i]; 164 delete masks[i];
165 } 165 }
166 166
@@ -218,58 +218,59 @@ void VideoWidget::resizeEvent( QResizeEvent * ) {
218static bool videoSliderBeingMoved = FALSE; 218static bool videoSliderBeingMoved = FALSE;
219 219
220void VideoWidget::sliderPressed() { 220void VideoWidget::sliderPressed() {
221 videoSliderBeingMoved = TRUE; 221 videoSliderBeingMoved = TRUE;
222} 222}
223 223
224void VideoWidget::sliderReleased() { 224void VideoWidget::sliderReleased() {
225 videoSliderBeingMoved = FALSE; 225 videoSliderBeingMoved = FALSE;
226 if ( slider->width() == 0 ) { 226 if ( slider->width() == 0 ) {
227 return; 227 return;
228 } 228 }
229 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); 229 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width());
230 mediaPlayerState->setPosition( val ); 230 mediaPlayerState->setPosition( val );
231} 231}
232 232
233void VideoWidget::setPosition( long i ) { 233void VideoWidget::setPosition( long i ) {
234 updateSlider( i, mediaPlayerState->length() ); 234 updateSlider( i, mediaPlayerState->length() );
235} 235}
236 236
237 237
238void VideoWidget::setLength( long max ) { 238void VideoWidget::setLength( long max ) {
239 updateSlider( mediaPlayerState->position(), max ); 239 updateSlider( mediaPlayerState->position(), max );
240} 240}
241 241
242void VideoWidget::setView( char view ) { 242void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType )
243 243{
244 if ( view == 'v' ) { 244 if ( displayType == MediaPlayerState::Video ) {
245 makeVisible(); 245 makeVisible();
246 } else { 246 return;
247 // Effectively blank the view next time we show it so it looks nicer
248 scaledWidth = 0;
249 scaledHeight = 0;
250 hide();
251 } 247 }
248
249 // Effectively blank the view next time we show it so it looks nicer
250 scaledWidth = 0;
251 scaledHeight = 0;
252 hide();
252} 253}
253 254
254void VideoWidget::updateSlider( long i, long max ) { 255void VideoWidget::updateSlider( long i, long max ) {
255 // Will flicker too much if we don't do this 256 // Will flicker too much if we don't do this
256 if ( max == 0 ) { 257 if ( max == 0 ) {
257 return; 258 return;
258 } 259 }
259 int width = slider->width(); 260 int width = slider->width();
260 int val = int((double)i * width / max); 261 int val = int((double)i * width / max);
261 if ( !mediaPlayerState->isFullscreen() && !videoSliderBeingMoved ) { 262 if ( !mediaPlayerState->isFullscreen() && !videoSliderBeingMoved ) {
262 if ( slider->value() != val ) { 263 if ( slider->value() != val ) {
263 slider->setValue( val ); 264 slider->setValue( val );
264 } 265 }
265 if ( slider->maxValue() != width ) { 266 if ( slider->maxValue() != width ) {
266 slider->setMaxValue( width ); 267 slider->setMaxValue( width );
267 } 268 }
268 } 269 }
269} 270}
270 271
271void VideoWidget::setToggleButton( int i, bool down ) { 272void VideoWidget::setToggleButton( int i, bool down ) {
272 if ( down != videoButtons[i].isDown ) { 273 if ( down != videoButtons[i].isDown ) {
273 toggleButton( i ); 274 toggleButton( i );
274 } 275 }
275} 276}
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index 990fa5f..89af646 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -16,81 +16,83 @@
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..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library 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  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library 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#ifndef VIDEO_WIDGET_H 34#ifndef VIDEO_WIDGET_H
35#define VIDEO_WIDGET_H 35#define VIDEO_WIDGET_H
36 36
37#include <qwidget.h> 37#include <qwidget.h>
38#include "xinevideowidget.h" 38#include "xinevideowidget.h"
39 39
40#include "mediaplayerstate.h"
41
40class QPixmap; 42class QPixmap;
41class QSlider; 43class QSlider;
42 44
43enum VideoButtons { 45enum VideoButtons {
44 VideoStop = 0, 46 VideoStop = 0,
45 VideoPlay, 47 VideoPlay,
46// VideoPause, 48// VideoPause,
47 VideoPrevious, 49 VideoPrevious,
48 VideoNext, 50 VideoNext,
49 VideoVolUp, 51 VideoVolUp,
50 VideoVolDown, 52 VideoVolDown,
51 VideoFullscreen 53 VideoFullscreen
52}; 54};
53 55
54class VideoWidget : public QWidget { 56class VideoWidget : public QWidget {
55 Q_OBJECT 57 Q_OBJECT
56public: 58public:
57 VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); 59 VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 );
58 ~VideoWidget(); 60 ~VideoWidget();
59 61
60 62
61 XineVideoWidget* vidWidget(); 63 XineVideoWidget* vidWidget();
62public slots: 64public slots:
63 void updateSlider( long, long ); 65 void updateSlider( long, long );
64 void sliderPressed( ); 66 void sliderPressed( );
65 void sliderReleased( ); 67 void sliderReleased( );
66 void setPlaying( bool b); 68 void setPlaying( bool b);
67 void setFullscreen( bool b ); 69 void setFullscreen( bool b );
68 void makeVisible(); 70 void makeVisible();
69 void backToNormal(); 71 void backToNormal();
70 void setPosition( long ); 72 void setPosition( long );
71 void setLength( long ); 73 void setLength( long );
72 void setView( char ); 74 void setDisplayType( MediaPlayerState::DisplayType displayType );
73 75
74signals: 76signals:
75 void moreClicked(); 77 void moreClicked();
76 void lessClicked(); 78 void lessClicked();
77 void moreReleased(); 79 void moreReleased();
78 void lessReleased(); 80 void lessReleased();
79 void sliderMoved( long ); 81 void sliderMoved( long );
80 void videoResized ( const QSize &s ); 82 void videoResized ( const QSize &s );
81 83
82protected: 84protected:
83 85
84 void resizeEvent( QResizeEvent * ); 86 void resizeEvent( QResizeEvent * );
85 void paintEvent( QPaintEvent *pe ); 87 void paintEvent( QPaintEvent *pe );
86 void showEvent( QShowEvent *se ); 88 void showEvent( QShowEvent *se );
87 void mouseMoveEvent( QMouseEvent *event ); 89 void mouseMoveEvent( QMouseEvent *event );
88 void mousePressEvent( QMouseEvent *event ); 90 void mousePressEvent( QMouseEvent *event );
89 void mouseReleaseEvent( QMouseEvent *event ); 91 void mouseReleaseEvent( QMouseEvent *event );
90 void closeEvent( QCloseEvent *event ); 92 void closeEvent( QCloseEvent *event );
91 void keyReleaseEvent( QKeyEvent *e); 93 void keyReleaseEvent( QKeyEvent *e);
92 94
93private: 95private:
94// Ticker songInfo; 96// Ticker songInfo;
95 QPixmap *pixBg; 97 QPixmap *pixBg;
96 QImage *imgUp; 98 QImage *imgUp;