summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/videowidget.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/videowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp23
1 files changed, 5 insertions, 18 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index af06079..188b18d 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -23,25 +23,24 @@
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#include <qpe/resource.h> 34#include <qpe/resource.h>
35#include <qpe/mediaplayerplugininterface.h>
36#include <qpe/config.h> 35#include <qpe/config.h>
37 36
38#include <qwidget.h> 37#include <qwidget.h>
39#include <qpainter.h> 38#include <qpainter.h>
40#include <qpixmap.h> 39#include <qpixmap.h>
41#include <qslider.h> 40#include <qslider.h>
42#include <qdrawutil.h> 41#include <qdrawutil.h>
43#include "videowidget.h" 42#include "videowidget.h"
44#include "mediaplayerstate.h" 43#include "mediaplayerstate.h"
45 44
46 45
47#ifdef Q_WS_QWS 46#ifdef Q_WS_QWS
@@ -78,44 +77,45 @@ MediaButton videoButtons[] = {
78 77
79 78
80static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 79static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton));
81 80
82 81
83VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : 82VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
84 QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { 83 QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) {
85 setCaption( tr("OpiePlayer - Video") ); 84 setCaption( tr("OpiePlayer - Video") );
86 Config cfg("OpiePlayer"); 85 Config cfg("OpiePlayer");
87 cfg.setGroup("VideoWidget"); 86 cfg.setGroup("VideoWidget");
88 87
89 QString Button0aPix, Button0bPix, controlsPix; 88 QString Button0aPix, Button0bPix, controlsPix;
90 //backgroundPix=cfg.readEntry( "backgroundPix", "opieplayer/metalFinish");
91 Button0aPix=cfg.readEntry( "Button0aPix", "opieplayer/mediaButton0a"); 89 Button0aPix=cfg.readEntry( "Button0aPix", "opieplayer/mediaButton0a");
92 Button0bPix=cfg.readEntry( "Button0bPix","opieplayer/mediaButton0b"); 90 Button0bPix=cfg.readEntry( "Button0bPix","opieplayer/mediaButton0b");
93 controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls0" ); 91 controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls0" );
94 92
95 cfg.setGroup("AudioWidget"); 93 cfg.setGroup("AudioWidget");
96 QString skin = cfg.readEntry("Skin","default"); 94 QString skin = cfg.readEntry("Skin","default");
97 QString skinPath = "opieplayer/skins/" + skin; 95 QString skinPath = "opieplayer/skins/" + skin;
98 backgroundPix = QString("%1/background").arg(skinPath) ; 96 backgroundPix = QString("%1/background").arg(skinPath) ;
99 97
100 setBackgroundPixmap( Resource::loadPixmap( backgroundPix) ); 98 setBackgroundPixmap( Resource::loadPixmap( backgroundPix) );
101 pixmaps[0] = new QPixmap( Resource::loadPixmap( Button0aPix ) ); 99 pixmaps[0] = new QPixmap( Resource::loadPixmap( Button0aPix ) );
102 pixmaps[1] = new QPixmap( Resource::loadPixmap( Button0bPix ) ); 100 pixmaps[1] = new QPixmap( Resource::loadPixmap( Button0bPix ) );
103 pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix) ); 101 pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix) );
104 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); 102 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 );
105 103
106 slider = new QSlider( Qt::Horizontal, this ); 104 slider = new QSlider( Qt::Horizontal, this );
107 slider->setMinValue( 0 ); 105 slider->setMinValue( 0 );
108 slider->setMaxValue( 1 ); 106 slider->setMaxValue( 1 );
109 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 107
108 slider->setBackgroundPixmap( *this->backgroundPixmap () ); //Resource::loadPixmap( backgroundPix ) );
109 slider->setBackgroundOrigin( QWidget::ParentOrigin);
110 slider->setFocusPolicy( QWidget::NoFocus ); 110 slider->setFocusPolicy( QWidget::NoFocus );
111 slider->setGeometry( QRect( 7, 250, 220, 20 ) ); 111 slider->setGeometry( QRect( 7, 250, 220, 20 ) );
112 112
113 videoFrame = new XineVideoWidget ( this, "Video frame" ); 113 videoFrame = new XineVideoWidget ( this, "Video frame" );
114 114
115 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 115 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
116 116
117 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 117 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
118 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 118 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
119 119
120 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 120 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
121 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 121 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
@@ -235,25 +235,27 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
235 QPoint dXY = center - event->pos(); 235 QPoint dXY = center - event->pos();
236 int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); 236 int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y();
237 bool isOnButton = dist <= (radius * radius); 237 bool isOnButton = dist <= (radius * radius);
238 if ( isOnButton != videoButtons[i].isHeld ) { 238 if ( isOnButton != videoButtons[i].isHeld ) {
239 videoButtons[i].isHeld = isOnButton; 239 videoButtons[i].isHeld = isOnButton;
240 toggleButton(i); 240 toggleButton(i);
241 } 241 }
242 } else { 242 } else {
243 if ( videoButtons[i].isHeld ) { 243 if ( videoButtons[i].isHeld ) {
244 videoButtons[i].isHeld = FALSE; 244 videoButtons[i].isHeld = FALSE;
245 if ( !videoButtons[i].isToggle ) 245 if ( !videoButtons[i].isToggle )
246 setToggleButton( i, FALSE ); 246 setToggleButton( i, FALSE );
247 qDebug("button toggled3 %d",i);
247 } 248 }
249
248 } 250 }
249 switch (i) { 251 switch (i) {
250 case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; 252 case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return;
251 case VideoStop: mediaPlayerState->setPlaying(FALSE); return; 253 case VideoStop: mediaPlayerState->setPlaying(FALSE); return;
252 case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; 254 case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return;
253 case VideoNext: mediaPlayerState->setNext(); return; 255 case VideoNext: mediaPlayerState->setNext(); return;
254 case VideoPrevious: mediaPlayerState->setPrev(); return; 256 case VideoPrevious: mediaPlayerState->setPrev(); return;
255 case VideoPlayList: mediaPlayerState->setList(); return; 257 case VideoPlayList: mediaPlayerState->setList(); return;
256 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; 258 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
257 } 259 }
258 260
259 } 261 }
@@ -310,39 +312,24 @@ void VideoWidget::paintEvent( QPaintEvent * ) {
310 } 312 }
311 // draw the slider 313 // draw the slider
312 slider->repaint( TRUE ); 314 slider->repaint( TRUE );
313 } 315 }
314} 316}
315 317
316 318
317void VideoWidget::closeEvent( QCloseEvent* ) { 319void VideoWidget::closeEvent( QCloseEvent* ) {
318 mediaPlayerState->setList(); 320 mediaPlayerState->setList();
319} 321}
320 322
321 323
322bool VideoWidget::playVideo() {
323 bool result = FALSE;
324
325 int stream = 0;
326
327 int sw = 240;
328 int sh = 320;
329 int dd = QPixmap::defaultDepth();
330 int w = height();
331 int h = width();
332
333 return true;
334}
335
336
337 324
338void VideoWidget::keyReleaseEvent( QKeyEvent *e) 325void VideoWidget::keyReleaseEvent( QKeyEvent *e)
339{ 326{
340 switch ( e->key() ) { 327 switch ( e->key() ) {
341////////////////////////////// Zaurus keys 328////////////////////////////// Zaurus keys
342 case Key_Home: 329 case Key_Home:
343 break; 330 break;
344 case Key_F9: //activity 331 case Key_F9: //activity
345 break; 332 break;
346 case Key_F10: //contacts 333 case Key_F10: //contacts
347// hide(); 334// hide();
348 break; 335 break;