-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 24 |
2 files changed, 6 insertions, 19 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index cd53748..cce445b 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -1,50 +1,49 @@ | |||
1 | 1 | ||
2 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 | ||
3 | #define QTOPIA_INTERNAL_FSLP | 2 | #define QTOPIA_INTERNAL_FSLP |
4 | #include <qpe/qcopenvelope_qws.h> | 3 | #include <qpe/qcopenvelope_qws.h> |
5 | 4 | ||
6 | #include <qpe/qpemenubar.h> | 5 | #include <qpe/qpemenubar.h> |
7 | #include <qpe/qpetoolbar.h> | 6 | #include <qpe/qpetoolbar.h> |
8 | #include <qpe/fileselector.h> | 7 | #include <qpe/fileselector.h> |
9 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
10 | #include <qpe/lnkproperties.h> | 9 | #include <qpe/lnkproperties.h> |
11 | #include <qpe/storage.h> | 10 | #include <qpe/storage.h> |
12 | 11 | ||
13 | #include <qpe/applnk.h> | 12 | #include <qpe/applnk.h> |
14 | #include <qpe/config.h> | 13 | #include <qpe/config.h> |
15 | #include <qpe/global.h> | 14 | #include <qpe/global.h> |
16 | #include <qpe/resource.h> | 15 | #include <qpe/resource.h> |
17 | #include <qaction.h> | 16 | #include <qaction.h> |
18 | #include <qcursor.h> | 17 | #include <qcursor.h> |
19 | #include <qimage.h> | 18 | #include <qimage.h> |
20 | #include <qfile.h> | 19 | #include <qfile.h> |
21 | #include <qdir.h> | 20 | #include <qdir.h> |
22 | #include <qlayout.h> | 21 | #include <qlayout.h> |
23 | #include <qlabel.h> | 22 | #include <qlabel.h> |
24 | #include <qlist.h> | 23 | #include <qlist.h> |
25 | #include <qlistbox.h> | 24 | #include <qlistbox.h> |
26 | #include <qmainwindow.h> | 25 | #include <qmainwindow.h> |
27 | #include <qmessagebox.h> | 26 | #include <qmessagebox.h> |
28 | #include <qtoolbutton.h> | 27 | #include <qtoolbutton.h> |
29 | #include <qtabwidget.h> | 28 | #include <qtabwidget.h> |
30 | #include <qlistview.h> | 29 | #include <qlistview.h> |
31 | #include <qpoint.h> | 30 | #include <qpoint.h> |
32 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
33 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
34 | #include <qregexp.h> | 33 | #include <qregexp.h> |
35 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
36 | 35 | ||
37 | 36 | ||
38 | #include "playlistselection.h" | 37 | #include "playlistselection.h" |
39 | #include "playlistwidget.h" | 38 | #include "playlistwidget.h" |
40 | #include "mediaplayerstate.h" | 39 | #include "mediaplayerstate.h" |
41 | 40 | ||
42 | #include "inputDialog.h" | 41 | #include "inputDialog.h" |
43 | 42 | ||
44 | #include <stdlib.h> | 43 | #include <stdlib.h> |
45 | #include "audiowidget.h" | 44 | #include "audiowidget.h" |
46 | #include "videowidget.h" | 45 | #include "videowidget.h" |
47 | 46 | ||
48 | #include <unistd.h> | 47 | #include <unistd.h> |
49 | #include <sys/file.h> | 48 | #include <sys/file.h> |
50 | #include <sys/ioctl.h> | 49 | #include <sys/ioctl.h> |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index d3898a0..bce6b89 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -77,98 +77,98 @@ MediaButton videoButtons[] = { | |||
77 | }; | 77 | }; |
78 | 78 | ||
79 | 79 | ||
80 | static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | 80 | static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); |
81 | 81 | ||
82 | 82 | ||
83 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | 83 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : |
84 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | 84 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { |
85 | setCaption( tr("OpiePlayer - Video") ); | 85 | setCaption( tr("OpiePlayer - Video") ); |
86 | Config cfg("OpiePlayer"); | 86 | Config cfg("OpiePlayer"); |
87 | cfg.setGroup("VideoWidget"); | 87 | cfg.setGroup("VideoWidget"); |
88 | 88 | ||
89 | QString backgroundPix, Button0aPix, Button0bPix, controlsPix; | 89 | QString backgroundPix, Button0aPix, Button0bPix, controlsPix; |
90 | backgroundPix=cfg.readEntry( "backgroundPix", "opieplayer/metalFinish"); | 90 | backgroundPix=cfg.readEntry( "backgroundPix", "opieplayer/metalFinish"); |
91 | Button0aPix=cfg.readEntry( "Button0aPix", "opieplayer/mediaButton0a"); | 91 | Button0aPix=cfg.readEntry( "Button0aPix", "opieplayer/mediaButton0a"); |
92 | Button0bPix=cfg.readEntry( "Button0bPix","opieplayer/mediaButton0b"); | 92 | Button0bPix=cfg.readEntry( "Button0bPix","opieplayer/mediaButton0b"); |
93 | controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls0" ); | 93 | controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls0" ); |
94 | 94 | ||
95 | setBackgroundPixmap( Resource::loadPixmap( backgroundPix) ); | 95 | setBackgroundPixmap( Resource::loadPixmap( backgroundPix) ); |
96 | pixmaps[0] = new QPixmap( Resource::loadPixmap( Button0aPix ) ); | 96 | pixmaps[0] = new QPixmap( Resource::loadPixmap( Button0aPix ) ); |
97 | pixmaps[1] = new QPixmap( Resource::loadPixmap( Button0bPix ) ); | 97 | pixmaps[1] = new QPixmap( Resource::loadPixmap( Button0bPix ) ); |
98 | pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix) ); | 98 | pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix) ); |
99 | currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); | 99 | currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); |
100 | 100 | ||
101 | slider = new QSlider( Qt::Horizontal, this ); | 101 | slider = new QSlider( Qt::Horizontal, this ); |
102 | slider->setMinValue( 0 ); | 102 | slider->setMinValue( 0 ); |
103 | slider->setMaxValue( 1 ); | 103 | slider->setMaxValue( 1 ); |
104 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 104 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
105 | slider->setFocusPolicy( QWidget::NoFocus ); | 105 | slider->setFocusPolicy( QWidget::NoFocus ); |
106 | slider->setGeometry( QRect( 7, 250, 220, 20 ) ); | 106 | slider->setGeometry( QRect( 7, 250, 220, 20 ) ); |
107 | 107 | ||
108 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 108 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
109 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 109 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
110 | 110 | ||
111 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 111 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
112 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 112 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
113 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 113 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
114 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 114 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
115 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 115 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
116 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 116 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
117 | 117 | ||
118 | // Intialise state | 118 | // Intialise state |
119 | setLength( mediaPlayerState->length() ); | 119 | setLength( mediaPlayerState->length() ); |
120 | setPosition( mediaPlayerState->position() ); | 120 | setPosition( mediaPlayerState->position() ); |
121 | setFullscreen( mediaPlayerState->fullscreen() ); | 121 | setFullscreen( mediaPlayerState->fullscreen() ); |
122 | setPaused( mediaPlayerState->paused() ); | 122 | setPaused( mediaPlayerState->paused() ); |
123 | setPlaying( mediaPlayerState->playing() ); | 123 | setPlaying( mediaPlayerState->playing() ); |
124 | 124 | ||
125 | videoFrame = new XineVideoWidget( 200, 150 ,this, "Video frame" ); | 125 | videoFrame = new XineVideoWidget( 240, 155 ,this, "Video frame" ); |
126 | videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) ); | 126 | videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) ); |
127 | } | 127 | } |
128 | 128 | ||
129 | 129 | ||
130 | VideoWidget::~VideoWidget() { | 130 | VideoWidget::~VideoWidget() { |
131 | for ( int i = 0; i < 3; i++ ) { | 131 | for ( int i = 0; i < 3; i++ ) { |
132 | delete pixmaps[i]; | 132 | delete pixmaps[i]; |
133 | } | 133 | } |
134 | delete currentFrame; | 134 | delete currentFrame; |
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
138 | static bool videoSliderBeingMoved = FALSE; | 138 | static bool videoSliderBeingMoved = FALSE; |
139 | 139 | ||
140 | 140 | ||
141 | void VideoWidget::sliderPressed() { | 141 | void VideoWidget::sliderPressed() { |
142 | videoSliderBeingMoved = TRUE; | 142 | videoSliderBeingMoved = TRUE; |
143 | } | 143 | } |
144 | 144 | ||
145 | 145 | ||
146 | void VideoWidget::sliderReleased() { | 146 | void VideoWidget::sliderReleased() { |
147 | videoSliderBeingMoved = FALSE; | 147 | videoSliderBeingMoved = FALSE; |
148 | if ( slider->width() == 0 ) { | 148 | if ( slider->width() == 0 ) { |
149 | return; | 149 | return; |
150 | } | 150 | } |
151 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); | 151 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); |
152 | mediaPlayerState->setPosition( val ); | 152 | mediaPlayerState->setPosition( val ); |
153 | } | 153 | } |
154 | 154 | ||
155 | 155 | ||
156 | void VideoWidget::setPosition( long i ) { | 156 | void VideoWidget::setPosition( long i ) { |
157 | updateSlider( i, mediaPlayerState->length() ); | 157 | updateSlider( i, mediaPlayerState->length() ); |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | void VideoWidget::setLength( long max ) { | 161 | void VideoWidget::setLength( long max ) { |
162 | updateSlider( mediaPlayerState->position(), max ); | 162 | updateSlider( mediaPlayerState->position(), max ); |
163 | } | 163 | } |
164 | 164 | ||
165 | 165 | ||
166 | void VideoWidget::setView( char view ) { | 166 | void VideoWidget::setView( char view ) { |
167 | if ( view == 'v' ) { | 167 | if ( view == 'v' ) { |
168 | makeVisible(); | 168 | makeVisible(); |
169 | } else { | 169 | } else { |
170 | // Effectively blank the view next time we show it so it looks nicer | 170 | // Effectively blank the view next time we show it so it looks nicer |
171 | scaledWidth = 0; | 171 | scaledWidth = 0; |
172 | scaledHeight = 0; | 172 | scaledHeight = 0; |
173 | hide(); | 173 | hide(); |
174 | } | 174 | } |
@@ -243,118 +243,106 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
243 | case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; | 243 | case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; |
244 | case VideoStop: mediaPlayerState->setPlaying(FALSE); return; | 244 | case VideoStop: mediaPlayerState->setPlaying(FALSE); return; |
245 | case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; | 245 | case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; |
246 | case VideoNext: mediaPlayerState->setNext(); return; | 246 | case VideoNext: mediaPlayerState->setNext(); return; |
247 | case VideoPrevious: mediaPlayerState->setPrev(); return; | 247 | case VideoPrevious: mediaPlayerState->setPrev(); return; |
248 | case VideoPlayList: mediaPlayerState->setList(); return; | 248 | case VideoPlayList: mediaPlayerState->setList(); return; |
249 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 249 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
250 | } | 250 | } |
251 | 251 | ||
252 | } | 252 | } |
253 | } | 253 | } |
254 | 254 | ||
255 | 255 | ||
256 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 256 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
257 | mouseMoveEvent( event ); | 257 | mouseMoveEvent( event ); |
258 | } | 258 | } |
259 | 259 | ||
260 | 260 | ||
261 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 261 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
262 | if ( mediaPlayerState->fullscreen() ) { | 262 | if ( mediaPlayerState->fullscreen() ) { |
263 | mediaPlayerState->setFullscreen( FALSE ); | 263 | mediaPlayerState->setFullscreen( FALSE ); |
264 | makeVisible(); | 264 | makeVisible(); |
265 | 265 | ||
266 | mouseMoveEvent( event ); | 266 | mouseMoveEvent( event ); |
267 | } | 267 | } |
268 | } | 268 | } |
269 | 269 | ||
270 | 270 | ||
271 | void VideoWidget::makeVisible() { | 271 | void VideoWidget::makeVisible() { |
272 | if ( mediaPlayerState->fullscreen() ) { | 272 | if ( mediaPlayerState->fullscreen() ) { |
273 | setBackgroundMode( QWidget::NoBackground ); | 273 | setBackgroundMode( QWidget::NoBackground ); |
274 | showFullScreen(); | 274 | showFullScreen(); |
275 | resize( qApp->desktop()->size() ); | 275 | resize( qApp->desktop()->size() ); |
276 | slider->hide(); | 276 | slider->hide(); |
277 | } else { | 277 | } else { |
278 | setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); | 278 | setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); |
279 | showNormal(); | 279 | showNormal(); |
280 | showMaximized(); | 280 | showMaximized(); |
281 | slider->show(); | 281 | slider->show(); |
282 | } | 282 | } |
283 | } | 283 | } |
284 | 284 | ||
285 | 285 | ||
286 | void VideoWidget::paintEvent( QPaintEvent * ) { | 286 | void VideoWidget::paintEvent( QPaintEvent * ) { |
287 | QPainter p( this ); | 287 | QPainter p( this ); |
288 | 288 | ||
289 | if ( mediaPlayerState->fullscreen() ) { | 289 | if ( mediaPlayerState->fullscreen() ) { |
290 | // Clear the background | 290 | // Clear the background |
291 | // p.setBrush( QBrush( Qt::black ) ); | 291 | p.setBrush( QBrush( Qt::black ) ); |
292 | //p.drawRect( rect() ); | 292 | videoFrame->setGeometry( QRect( 0, 0 , 240 ,340 ) ); |
293 | 293 | ||
294 | } else { | 294 | } else { |
295 | // draw border | 295 | // draw the buttons |
296 | qDrawShadePanel( &p, 4, 15, 230, 170, colorGroup(), TRUE, 5, NULL ); | ||
297 | |||
298 | // Clear the movie screen first | ||
299 | // p.setBrush( QBrush( Qt::black ) ); | ||
300 | // p.drawRect( 9, 20, 220, 160 ); | ||
301 | |||
302 | // draw current frame (centrally positioned from scaling to maintain aspect ratio) | ||
303 | //p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); | ||
304 | |||
305 | // draw the buttons | ||
306 | for ( int i = 0; i < numButtons; i++ ) { | 296 | for ( int i = 0; i < numButtons; i++ ) { |
307 | paintButton( &p, i ); | 297 | paintButton( &p, i ); |
308 | } | 298 | } |
309 | |||
310 | // draw the slider | 299 | // draw the slider |
311 | slider->repaint( TRUE ); | 300 | slider->repaint( TRUE ); |
312 | //videoFrame->repaint( TRUE ); | ||
313 | } | 301 | } |
314 | } | 302 | } |
315 | 303 | ||
316 | 304 | ||
317 | void VideoWidget::closeEvent( QCloseEvent* ) { | 305 | void VideoWidget::closeEvent( QCloseEvent* ) { |
318 | mediaPlayerState->setList(); | 306 | mediaPlayerState->setList(); |
319 | } | 307 | } |
320 | 308 | ||
321 | 309 | ||
322 | bool VideoWidget::playVideo() { | 310 | bool VideoWidget::playVideo() { |
323 | bool result = FALSE; | 311 | bool result = FALSE; |
324 | 312 | ||
325 | int stream = 0; | 313 | int stream = 0; |
326 | 314 | ||
327 | int sw = 240; | 315 | int sw = 240; |
328 | int sh = 320; | 316 | int sh = 320; |
329 | int dd = QPixmap::defaultDepth(); | 317 | int dd = QPixmap::defaultDepth(); |
330 | int w = height(); | 318 | int w = height(); |
331 | int h = width(); | 319 | int h = width(); |
332 | 320 | ||
333 | return true; | 321 | return true; |
334 | } | 322 | } |
335 | 323 | ||
336 | 324 | ||
337 | 325 | ||
338 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) | 326 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) |
339 | { | 327 | { |
340 | switch ( e->key() ) { | 328 | switch ( e->key() ) { |
341 | ////////////////////////////// Zaurus keys | 329 | ////////////////////////////// Zaurus keys |
342 | case Key_Home: | 330 | case Key_Home: |
343 | break; | 331 | break; |
344 | case Key_F9: //activity | 332 | case Key_F9: //activity |
345 | break; | 333 | break; |
346 | case Key_F10: //contacts | 334 | case Key_F10: //contacts |
347 | // hide(); | 335 | // hide(); |
348 | break; | 336 | break; |
349 | case Key_F11: //menu | 337 | case Key_F11: //menu |
350 | break; | 338 | break; |
351 | case Key_F12: //home | 339 | case Key_F12: //home |
352 | break; | 340 | break; |
353 | case Key_F13: //mail | 341 | case Key_F13: //mail |
354 | break; | 342 | break; |
355 | case Key_Space: { | 343 | case Key_Space: { |
356 | if(mediaPlayerState->playing()) { | 344 | if(mediaPlayerState->playing()) { |
357 | mediaPlayerState->setPlaying(FALSE); | 345 | mediaPlayerState->setPlaying(FALSE); |
358 | } else { | 346 | } else { |
359 | mediaPlayerState->setPlaying(TRUE); | 347 | mediaPlayerState->setPlaying(TRUE); |
360 | } | 348 | } |