summaryrefslogtreecommitdiff
path: root/noncore/multimedia
Unidiff
Diffstat (limited to 'noncore/multimedia') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp41
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h6
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp246
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h17
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp323
7 files changed, 384 insertions, 254 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index dc90a62..2ee9383 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -139,3 +139,3 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
139 139
140 QString skinPath = "opieplayer/skins/" + skin; 140 QString skinPath = "opieplayer2/skins/" + skin;
141 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 141 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index 135c67c..57b1c81 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -161,2 +161,5 @@ void MediaPlayerState::setPlaylist( bool b ) {
161void MediaPlayerState::setPaused( bool b ) { 161void MediaPlayerState::setPaused( bool b ) {
162if(b) qDebug("setPaused true");
163 else qDebug("setPaused false");
164
162 if ( isPaused == b ) { 165 if ( isPaused == b ) {
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index b43d9f7..65458e7 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -12,2 +12,3 @@
12#include <qpe/applnk.h> 12#include <qpe/applnk.h>
13#include <qpopupmenu.h>
13#include <qpe/config.h> 14#include <qpe/config.h>
@@ -160,9 +161,15 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
160 161
161 QPopupMenu *pmView = new QPopupMenu( this ); 162
163 pmView = new QPopupMenu( this );
162 menu->insertItem( tr( "View" ), pmView ); 164 menu->insertItem( tr( "View" ), pmView );
165 pmView->isCheckable();
166
167 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), this, SLOT( toggleFull() ) );
163 168
164 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); 169 Config cfg( "OpiePlayer" );
165 fullScreenButton->addTo(pmView); 170 bool b= cfg.readBoolEntry("FullScreen", 0);
166 scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); 171 mediaPlayerState->setFullscreen( b );
167 //scaleButton->addTo(pmView); 172 pmView->setItemChecked( -16, b );
173
174 pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), this, SLOT(toggleScaled() ) );
168 175
@@ -244,4 +251,7 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
244 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); 251 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
245 connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); 252
246 connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); 253connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) );
254
255// connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) );
256
247 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 257 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
@@ -268,3 +278,2 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
268 278
269 Config cfg( "OpiePlayer" );
270 readConfig( cfg ); 279 readConfig( cfg );
@@ -1211 +1220,17 @@ void PlayListWidget::readPls(const QString &filename) {
1211 1220
1221void PlayListWidget::pmViewActivated(int index) {
1222qDebug("%d", index);
1223switch(index) {
1224 case -16:
1225 {
1226
1227 mediaPlayerState->toggleFullscreen();
1228 bool b=mediaPlayerState->fullscreen();
1229 pmView->setItemChecked( index,b);
1230 Config cfg( "OpiePlayer" );
1231 cfg.writeEntry("FullScreen", b);
1232
1233 }
1234 break;
1235};
1236}
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index e44096b..fdfa666 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -9,2 +9,3 @@
9#include <qpushbutton.h> 9#include <qpushbutton.h>
10#include <qpopupmenu.h>
10 11
@@ -27,3 +28,4 @@ public:
27 QTabWidget * tabWidget; 28 QTabWidget * tabWidget;
28 QAction *fullScreenButton, *scaleButton; 29// MenuItem *fullScreenButton, *scaleButton;
30// QAction *fullScreenButton, *scaleButton;
29 DocLnkSet files; 31 DocLnkSet files;
@@ -32,2 +34,3 @@ public:
32 QLabel *libString; 34 QLabel *libString;
35 QPopupMenu *pmView ;
33 bool fromSetDocument; 36 bool fromSetDocument;
@@ -69,2 +72,3 @@ private:
69private slots: 72private slots:
73 void pmViewActivated(int);
70 void writem3u(); 74 void writem3u();
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 188b18d..419c3ae 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -34,2 +34,3 @@
34#include <qpe/resource.h> 34#include <qpe/resource.h>
35#include <qpe/mediaplayerplugininterface.h>
35#include <qpe/config.h> 36#include <qpe/config.h>
@@ -60,19 +61,18 @@ static const int yo = 0; // movable y offset
60struct MediaButton { 61struct MediaButton {
61 int xPos, yPos;
62 bool isToggle, isHeld, isDown; 62 bool isToggle, isHeld, isDown;
63 int controlType;
64}; 63};
65 64
66
67// Layout information for the videoButtons (and if it is a toggle button or not)
68MediaButton videoButtons[] = { 65MediaButton videoButtons[] = {
69 { 5+0*32+xo, 200+yo, FALSE, FALSE, FALSE, 4 }, // previous 66 { FALSE, FALSE, FALSE }, // previous
70 { 5+1*32+xo, 200+yo, FALSE, FALSE, FALSE, 1 }, // stop 67 { FALSE, FALSE, FALSE }, // stop
71 { 5+2*32+xo, 200+yo, TRUE, FALSE, FALSE, 0 }, // play 68 { TRUE, FALSE, FALSE }, // play
72 { 5+3*32+xo, 200+yo, TRUE, FALSE, FALSE, 2 }, // pause 69 { TRUE, FALSE, FALSE }, // pause
73 { 5+4*32+xo, 200+yo, FALSE, FALSE, FALSE, 3 }, // next 70 { FALSE, FALSE, FALSE }, // next
74 { 5+5*32+xo, 200+yo, FALSE, FALSE, FALSE, 8 }, // playlist 71 { FALSE, FALSE, FALSE }, // playlist
75 { 5+6*32+xo, 200+yo, TRUE, FALSE, FALSE, 9 } // fullscreen 72 { TRUE, FALSE, FALSE } // fullscreen
76}; 73};
77 74
75const char *skinV_mask_file_names[7] = {
76"stop","play","back","fwd","up","down","full"
77};
78 78
@@ -82,22 +82,44 @@ static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton));
82VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : 82VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
83 QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { 83QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) {
84 setCaption( tr("OpiePlayer - Video") ); 84 setCaption( tr("OpiePlayer - Video") );
85
86 videoFrame = new XineVideoWidget ( this, "Video frame" );
87 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
88
85 Config cfg("OpiePlayer"); 89 Config cfg("OpiePlayer");
86 cfg.setGroup("VideoWidget"); 90 cfg.setGroup("VideoWidget");
91 skin = cfg.readEntry("Skin","default");
92
93 QString skinPath = "opieplayer2/skins/" + skin;
94 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
95 imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
96 imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
97
98 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
99 imgButtonMask->fill( 0 );
100
101 for ( int i = 0; i < 7; i++ ) {
102 QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png";
103 masks[i] = new QBitmap( filename );
104 qDebug(filename);
105 if ( !masks[i]->isNull() ) {
106 QImage imgMask = masks[i]->convertToImage();
107 uchar **dest = imgButtonMask->jumpTable();
108 for ( int y = 0; y < imgUp->height(); y++ ) {
109 uchar *line = dest[y];
110 for ( int x = 0; x < imgUp->width(); x++ ) {
111 if ( !qRed( imgMask.pixel( x, y ) ) )
112 line[x] = i + 1;
113 }
114 }
115 }
87 116
88 QString Button0aPix, Button0bPix, controlsPix; 117 }
89 Button0aPix=cfg.readEntry( "Button0aPix", "opieplayer/mediaButton0a");
90 Button0bPix=cfg.readEntry( "Button0bPix","opieplayer/mediaButton0b");
91 controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls0" );
92 118
93 cfg.setGroup("AudioWidget"); 119 for ( int i = 0; i < 7; i++ ) {
94 QString skin = cfg.readEntry("Skin","default"); 120 buttonPixUp[i] = NULL;
95 QString skinPath = "opieplayer/skins/" + skin; 121 buttonPixDown[i] = NULL;
96 backgroundPix = QString("%1/background").arg(skinPath) ; 122 }
97 123
98 setBackgroundPixmap( Resource::loadPixmap( backgroundPix) ); 124 setBackgroundPixmap( *pixBg );
99 pixmaps[0] = new QPixmap( Resource::loadPixmap( Button0aPix ) );
100 pixmaps[1] = new QPixmap( Resource::loadPixmap( Button0bPix ) );
101 pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix) );
102 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 );
103 125
@@ -106,5 +128,3 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
106 slider->setMaxValue( 1 ); 128 slider->setMaxValue( 1 );
107 129 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
108 slider->setBackgroundPixmap( *this->backgroundPixmap () ); //Resource::loadPixmap( backgroundPix ) );
109 slider->setBackgroundOrigin( QWidget::ParentOrigin);
110 slider->setFocusPolicy( QWidget::NoFocus ); 130 slider->setFocusPolicy( QWidget::NoFocus );
@@ -112,6 +132,2 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
112 132
113 videoFrame = new XineVideoWidget ( this, "Video frame" );
114
115 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
116
117 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 133 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
@@ -126,9 +142,10 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
126 142
127 // Intialise state
128 setLength( mediaPlayerState->length() ); 143 setLength( mediaPlayerState->length() );
129 setPosition( mediaPlayerState->position() ); 144 setPosition( mediaPlayerState->position() );
130 setFullscreen( mediaPlayerState->fullscreen() ); 145
146 ////////////////////////// FIXME
147// setFullscreen( mediaPlayerState->fullscreen() );
131 setPaused( mediaPlayerState->paused() ); 148 setPaused( mediaPlayerState->paused() );
132 setPlaying( mediaPlayerState->playing() ); 149 setPlaying( mediaPlayerState->playing() );
133 150 qDebug("finished videowidget");
134} 151}
@@ -137,11 +154,64 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
137VideoWidget::~VideoWidget() { 154VideoWidget::~VideoWidget() {
138 for ( int i = 0; i < 3; i++ ) { 155 for ( int i = 0; i < 7; i++ ) {
139 delete pixmaps[i]; 156 delete buttonPixUp[i];
157 delete buttonPixDown[i];
158 }
159
160 delete pixBg;
161 delete imgUp;
162 delete imgDn;
163 delete imgButtonMask;
164 for ( int i = 0; i < 7; i++ ) {
165 delete masks[i];
140 } 166 }
141 delete currentFrame;
142} 167}
143 168
169QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
170 QPixmap pix( img.width(), img.height() );
171 QPainter p( &pix );
172 p.drawTiledPixmap( pix.rect(), bg, offset );
173 p.drawImage( 0, 0, img );
174 return new QPixmap( pix );
175}
144 176
145static bool videoSliderBeingMoved = FALSE; 177QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) {
178 QPixmap *pixmap = new QPixmap( pix );
179 pixmap->setMask( mask );
180 return pixmap;
181}
182
183void VideoWidget::resizeEvent( QResizeEvent * ) {
184 int h = height();
185 int w = width();
186 int Vh = 160;
187 //videoFrame->height();
188 int Vw = 220;
189 //videoFrame->width();
190// songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) );
191
192 slider->setFixedWidth( w - 110 );
193 slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) );
194 slider->setBackgroundOrigin( QWidget::ParentOrigin );
195// time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
196 xoff = 0;// ( imgUp->width() ) / 2;
197 yoff = 180;//(( Vh - imgUp->height() ) / 2) - 10;
198 QPoint p( xoff, yoff );
199
200 QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p );
201 QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p );
202
203 for ( int i = 0; i < 7; i++ ) {
204 if ( !masks[i]->isNull() ) {
205 delete buttonPixUp[i];
206 delete buttonPixDown[i];
207 buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] );
208 buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] );
209 }
210 }
146 211
212 delete pixUp;
213 delete pixDn;
214}
215
216static bool videoSliderBeingMoved = FALSE;
147 217
@@ -151,3 +221,2 @@ void VideoWidget::sliderPressed() {
151 221
152
153void VideoWidget::sliderReleased() { 222void VideoWidget::sliderReleased() {
@@ -161,3 +230,2 @@ void VideoWidget::sliderReleased() {
161 230
162
163void VideoWidget::setPosition( long i ) { 231void VideoWidget::setPosition( long i ) {
@@ -171,3 +239,2 @@ void VideoWidget::setLength( long max ) {
171 239
172
173void VideoWidget::setView( char view ) { 240void VideoWidget::setView( char view ) {
@@ -183,3 +250,2 @@ void VideoWidget::setView( char view ) {
183 250
184
185void VideoWidget::updateSlider( long i, long max ) { 251void VideoWidget::updateSlider( long i, long max ) {
@@ -201,3 +267,2 @@ void VideoWidget::updateSlider( long i, long max ) {
201 267
202
203void VideoWidget::setToggleButton( int i, bool down ) { 268void VideoWidget::setToggleButton( int i, bool down ) {
@@ -208,3 +273,2 @@ void VideoWidget::setToggleButton( int i, bool down ) {
208 273
209
210void VideoWidget::toggleButton( int i ) { 274void VideoWidget::toggleButton( int i ) {
@@ -215,11 +279,9 @@ void VideoWidget::toggleButton( int i ) {
215 279
216
217void VideoWidget::paintButton( QPainter *p, int i ) { 280void VideoWidget::paintButton( QPainter *p, int i ) {
218 int x = videoButtons[i].xPos;
219 int y = videoButtons[i].yPos;
220 int offset = 10 + videoButtons[i].isDown;
221 p->drawPixmap( x, y, *pixmaps[videoButtons[i].isDown] );
222 p->drawPixmap( x + 1 + offset, y + offset, *pixmaps[2], 9 * videoButtons[i].controlType, 0, 9, 9 );
223}
224 281
282 if ( videoButtons[i].isDown )
283 p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
284 else
285 p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
286}
225 287
@@ -227,12 +289,9 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
227 for ( int i = 0; i < numButtons; i++ ) { 289 for ( int i = 0; i < numButtons; i++ ) {
228 int x = videoButtons[i].xPos;
229 int y = videoButtons[i].yPos;
230 if ( event->state() == QMouseEvent::LeftButton ) { 290 if ( event->state() == QMouseEvent::LeftButton ) {
231 // The test to see if the mouse click is inside the circular button or not 291 // The test to see if the mouse click is inside the button or not
232 // (compared with the radius squared to avoid a square-root of our distance) 292 int x = event->pos().x() - xoff;
233 int radius = 16; 293 int y = event->pos().y() - yoff;
234 QPoint center = QPoint( x + radius, y + radius ); 294
235 QPoint dXY = center - event->pos(); 295 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
236 int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); 296 && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 );
237 bool isOnButton = dist <= (radius * radius);
238 if ( isOnButton != videoButtons[i].isHeld ) { 297 if ( isOnButton != videoButtons[i].isHeld ) {
@@ -246,5 +305,3 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
246 setToggleButton( i, FALSE ); 305 setToggleButton( i, FALSE );
247 qDebug("button toggled3 %d",i);
248 } 306 }
249
250 } 307 }
@@ -263,3 +320,2 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
263 320
264
265void VideoWidget::mousePressEvent( QMouseEvent *event ) { 321void VideoWidget::mousePressEvent( QMouseEvent *event ) {
@@ -268,3 +324,2 @@ void VideoWidget::mousePressEvent( QMouseEvent *event ) {
268 324
269
270void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 325void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
@@ -285,3 +340,3 @@ void VideoWidget::makeVisible() {
285 slider->hide(); 340 slider->hide();
286 videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); 341 videoFrame-> setGeometry ( 0, 0, width ( ), height ( ));
287 } else { 342 } else {
@@ -296,3 +351,3 @@ void VideoWidget::makeVisible() {
296 351
297void VideoWidget::paintEvent( QPaintEvent * ) { 352void VideoWidget::paintEvent( QPaintEvent * pe) {
298 QPainter p( this ); 353 QPainter p( this );
@@ -300,4 +355,4 @@ void VideoWidget::paintEvent( QPaintEvent * ) {
300 if ( mediaPlayerState->fullscreen() ) { 355 if ( mediaPlayerState->fullscreen() ) {
301 // Clear the background 356 // Clear the background
302 p.setBrush( QBrush( Qt::black ) ); 357 p.setBrush( QBrush( Qt::black ) );
303// videoFrame->setGeometry( QRect( 0, 0 , 240 ,320 ) ); 358// videoFrame->setGeometry( QRect( 0, 0 , 240 ,320 ) );
@@ -306,11 +361,26 @@ void VideoWidget::paintEvent( QPaintEvent * ) {
306 361
307 // videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) ); 362 // videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) );
308 // draw the buttons 363 // draw the buttons
309 364
310 for ( int i = 0; i < numButtons; i++ ) { 365 if ( !pe->erased() ) {
311 paintButton( &p, i ); 366 // Combine with background and double buffer
367 QPixmap pix( pe->rect().size() );
368 QPainter p( &pix );
369 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
370 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
371 for ( int i = 0; i < numButtons; i++ )
372 paintButton( &p, i );
373 QPainter p2( this );
374 p2.drawPixmap( pe->rect().topLeft(), pix );
375 } else {
376 QPainter p( this );
377 for ( int i = 0; i < numButtons; i++ )
378 paintButton( &p, i );
312 } 379 }
313 // draw the slider 380// for ( int i = 0; i < numButtons; i++ ) {
314 slider->repaint( TRUE ); 381// paintButton( &p, i );
315 } 382// }
383// // draw the slider
384// slider->repaint( TRUE );
385 }
316} 386}
@@ -323,5 +393,17 @@ void VideoWidget::closeEvent( QCloseEvent* ) {
323 393
394bool VideoWidget::playVideo() {
395 bool result = FALSE;
396
397 int stream = 0;
398
399 int sw = 240;
400 int sh = 320;
401 int dd = QPixmap::defaultDepth();
402 int w = height();
403 int h = width();
324 404
325void VideoWidget::keyReleaseEvent( QKeyEvent *e) 405 return true;
326{ 406}
407
408void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
327 switch ( e->key() ) { 409 switch ( e->key() ) {
@@ -372,2 +454,3 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e)
372} 454}
455
373XineVideoWidget* VideoWidget::vidWidget() { 456XineVideoWidget* VideoWidget::vidWidget() {
@@ -377,5 +460,4 @@ XineVideoWidget* VideoWidget::vidWidget() {
377 460
378void VideoWidget::setFullscreen ( bool b ) 461void VideoWidget::setFullscreen ( bool b ) {
379{ 462 setToggleButton( VideoFullscreen, b );
380 setToggleButton( VideoFullscreen, b );
381} 463}
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index 04e810e..830696e 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -58,2 +58,3 @@ public:
58 58
59 bool playVideo();
59 XineVideoWidget* vidWidget(); 60 XineVideoWidget* vidWidget();
@@ -73,5 +74,7 @@ signals:
73 void sliderMoved( long ); 74 void sliderMoved( long );
74 void videoResized ( const QSize &s ); 75 void videoResized ( const QSize &s );
75 76
76protected: 77protected:
78 QString skin;
79 void resizeEvent( QResizeEvent * );
77 void paintEvent( QPaintEvent *pe ); 80 void paintEvent( QPaintEvent *pe );
@@ -84,2 +87,14 @@ protected:
84private: 87private:
88// Ticker songInfo;
89 QPixmap *pixBg;
90 QImage *imgUp;
91 QImage *imgDn;
92 QImage *imgButtonMask;
93 QBitmap *masks[7];
94 QPixmap *buttonPixUp[7];
95 QPixmap *buttonPixDown[7];
96// QPixmap *pixmaps[4];
97 int xoff, yoff;
98
99
85 void paintButton( QPainter *p, int i ); 100 void paintButton( QPainter *p, int i );
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
index 98446a0..d65006b 100644
--- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp
+++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
@@ -41,2 +41,3 @@
41#include <qapplication.h> 41#include <qapplication.h>
42#include <qpainter.h>
42 43
@@ -49,7 +50,7 @@ static inline void memcpy_rev ( void *dst, void *src, size_t len )
49{ 50{
50 ((char *) src ) += len; 51 ((char *) src ) += len;
51 52
52 len >>= 1; 53 len >>= 1;
53 while ( len-- ) 54 while ( len-- )
54 *((short int *) dst )++ = *--((short int *) src ); 55 *((short int *) dst )++ = *--((short int *) src );
55} 56}
@@ -58,7 +59,7 @@ static inline void memcpy_step ( void *dst, void *src, size_t len, size_t step )
58{ 59{
59 len >>= 1; 60 len >>= 1;
60 while ( len-- ) { 61 while ( len-- ) {
61 *((short int *) dst )++ = *((short int *) src ); 62 *((short int *) dst )++ = *((short int *) src );
62 ((char *) src ) += step; 63 ((char *) src ) += step;
63 } 64 }
64} 65}
@@ -67,10 +68,10 @@ static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t st
67{ 68{
68 len >>= 1; 69 len >>= 1;
69 70
70 ((char *) src ) += ( len * step ); 71 ((char *) src ) += ( len * step );
71 72
72 while ( len-- ) { 73 while ( len-- ) {
73 ((char *) src ) -= step; 74 ((char *) src ) -= step;
74 *((short int *) dst )++ = *((short int *) src ); 75 *((short int *) dst )++ = *((short int *) src );
75 } 76 }
76} 77}
@@ -79,11 +80,11 @@ static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t st
79XineVideoWidget::XineVideoWidget ( QWidget* parent, const char* name ) 80XineVideoWidget::XineVideoWidget ( QWidget* parent, const char* name )
80 : QWidget ( parent, name, WRepaintNoErase | WResizeNoErase ) 81 : QWidget ( parent, name, WRepaintNoErase | WResizeNoErase )
81{ 82{
82 setBackgroundMode ( NoBackground ); 83 setBackgroundMode ( NoBackground );
83 84
84 m_image = 0; 85 m_image = 0;
85 m_buff = 0; 86 m_buff = 0;
86 m_bytes_per_line_fb = qt_screen-> linestep ( ); 87 m_bytes_per_line_fb = qt_screen-> linestep ( );
87 m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8; 88 m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8;
88 m_rotation = 0; 89 m_rotation = 0;
89} 90}
@@ -93,3 +94,3 @@ XineVideoWidget::~XineVideoWidget ( )
93{ 94{
94 delete m_image; 95 delete m_image;
95} 96}
@@ -98,4 +99,4 @@ void XineVideoWidget::clear ( )
98{ 99{
99 m_buff = 0; 100 m_buff = 0;
100 repaint ( false ); 101 repaint ( false );
101} 102}
@@ -104,96 +105,96 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
104{ 105{
105 //qWarning( "painting <<<" ); 106 //qWarning( "painting <<<" );
106 if ( m_buff == 0 ) { 107 if ( m_buff == 0 ) {
107 QPainter p ( this ); 108 QPainter p ( this );
108 p. fillRect ( rect ( ), black ); 109 p. fillRect ( rect ( ), black );
109 if ( m_image ) 110 if ( m_image )
110 p. drawImage ( 0, 0, *m_image ); 111 p. drawImage ( 0, 0, *m_image );
111 //qWarning ( "logo\n" ); 112 //qWarning ( "logo\n" );
112 } 113 }
113 else { 114 else {
114 // qWarning ( "paintevent\n" ); 115// qWarning ( "paintevent\n" );
115 116
116 QArray <QRect> qt_bug_workaround_clip_rects; 117 QArray <QRect> qt_bug_workaround_clip_rects;
117 118
118 { 119 {
119 QDirectPainter dp ( this ); 120 QDirectPainter dp ( this );
120 121
121 int rot = dp. transformOrientation ( ) + m_rotation; 122 int rot = dp. transformOrientation ( ) + m_rotation;
122 123
123 uchar *fb = dp. frameBuffer ( ); 124 uchar *fb = dp. frameBuffer ( );
124 uchar *frame = m_buff; // rot == 0 ? m_buff : m_buff + ( m_thisframe. height ( ) - 1 ) * m_bytes_per_line_frame; 125 uchar *frame = m_buff; // rot == 0 ? m_buff : m_buff + ( m_thisframe. height ( ) - 1 ) * m_bytes_per_line_frame;
125 126
126 QRect framerect = qt_screen-> mapToDevice ( QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )), QSize ( qt_screen-> width ( ), qt_screen-> height ( ))); 127 QRect framerect = qt_screen-> mapToDevice ( QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )), QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
127 128
128 qt_bug_workaround_clip_rects. resize ( dp. numRects ( )); 129 qt_bug_workaround_clip_rects. resize ( dp. numRects ( ));
129 130
130 for ( int i = dp. numRects ( ) - 1; i >= 0; i-- ) { 131 for ( int i = dp. numRects ( ) - 1; i >= 0; i-- ) {
131 const QRect &clip = dp. rect ( i ); 132 const QRect &clip = dp. rect ( i );
132 133
133 qt_bug_workaround_clip_rects [i] = qt_screen-> mapFromDevice ( clip, QSize ( qt_screen-> width ( ), qt_screen-> height ( ))); 134 qt_bug_workaround_clip_rects [i] = qt_screen-> mapFromDevice ( clip, QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
134 135
135 uchar *dst = fb + ( clip. x ( ) * m_bytes_per_pixel ) + ( clip. y ( ) * m_bytes_per_line_fb ); 136 uchar *dst = fb + ( clip. x ( ) * m_bytes_per_pixel ) + ( clip. y ( ) * m_bytes_per_line_fb );
136 uchar *src = frame; 137 uchar *src = frame;
137 138
138 switch ( rot ) { 139 switch ( rot ) {
139 case 0: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) ); break; 140 case 0: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) ); break;
140 case 1: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_pixel ) ); break; 141 case 1: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_pixel ) ); break;
141 case 2: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_line_frame ) ); break; 142 case 2: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_line_frame ) ); break;
142 case 3: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) ); break; 143 case 3: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) ); break;
143 } 144 }
144 145
145 uint leftfill = 0; 146 uint leftfill = 0;
146 uint framefill = 0; 147 uint framefill = 0;
147 uint rightfill = 0; 148 uint rightfill = 0;
148 uint clipwidth = clip. width ( ) * m_bytes_per_pixel; 149 uint clipwidth = clip. width ( ) * m_bytes_per_pixel;
149 150
150 if ( clip. left ( ) < framerect. left ( )) 151 if ( clip. left ( ) < framerect. left ( ))
151 leftfill = (( framerect. left ( ) - clip. left ( )) * m_bytes_per_pixel ) <? clipwidth; 152 leftfill = (( framerect. left ( ) - clip. left ( )) * m_bytes_per_pixel ) <? clipwidth;
152 if ( clip. right ( ) > framerect. right ( )) 153 if ( clip. right ( ) > framerect. right ( ))
153 rightfill = (( clip. right ( ) - framerect. right ( )) * m_bytes_per_pixel ) <? clipwidth; 154 rightfill = (( clip. right ( ) - framerect. right ( )) * m_bytes_per_pixel ) <? clipwidth;
154 155
155 framefill = clipwidth - ( leftfill + rightfill ); 156 framefill = clipwidth - ( leftfill + rightfill );
156 157
157 for ( int y = clip. top ( ); y <= clip. bottom ( ); y++ ) { 158 for ( int y = clip. top ( ); y <= clip. bottom ( ); y++ ) {
158 if (( y < framerect. top ( )) || ( y > framerect. bottom ( ))) { 159 if (( y < framerect. top ( )) || ( y > framerect. bottom ( ))) {
159 memset ( dst, 0, clipwidth ); 160 memset ( dst, 0, clipwidth );
160 } 161 }
161 else { 162 else {
162 if ( leftfill ) 163 if ( leftfill )
163 memset ( dst, 0, leftfill ); 164 memset ( dst, 0, leftfill );
164 165
165 if ( framefill ) { 166 if ( framefill ) {
166 switch ( rot ) { 167 switch ( rot ) {
167 case 0: memcpy ( dst + leftfill, src, framefill ); break; 168 case 0: memcpy ( dst + leftfill, src, framefill ); break;
168 case 1: memcpy_step ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break; 169 case 1: memcpy_step ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break;
169 case 2: memcpy_rev ( dst + leftfill, src, framefill ); break; 170 case 2: memcpy_rev ( dst + leftfill, src, framefill ); break;
170 case 3: memcpy_step_rev ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break; 171 case 3: memcpy_step_rev ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break;
171 } 172 }
172 } 173 }
173 if ( rightfill ) 174 if ( rightfill )
174 memset ( dst + leftfill + framefill, 0, rightfill ); 175 memset ( dst + leftfill + framefill, 0, rightfill );
175 } 176 }
176 177
177 dst += m_bytes_per_line_fb; 178 dst += m_bytes_per_line_fb;
178 179
179 switch ( rot ) { 180 switch ( rot ) {
180 case 0: src += m_bytes_per_line_frame; break; 181 case 0: src += m_bytes_per_line_frame; break;
181 case 1: src -= m_bytes_per_pixel; break; 182 case 1: src -= m_bytes_per_pixel; break;
182 case 2: src -= m_bytes_per_line_frame; break; 183 case 2: src -= m_bytes_per_line_frame; break;
183 case 3: src += m_bytes_per_pixel; break; 184 case 3: src += m_bytes_per_pixel; break;
184 } 185 }
185 } 186 }
186 } 187 }
187 } 188 }
188 //qWarning ( " ||| painting |||" ); 189 //qWarning ( " ||| painting |||" );
189 { 190 {
190 // QVFB hack by MArtin Jones 191 // QVFB hack by MArtin Jones
191 QPainter p ( this ); 192 QPainter p ( this );
192 193
193 for ( int i = qt_bug_workaround_clip_rects. size ( ) - 1; i >= 0; i-- ) { 194 for ( int i = qt_bug_workaround_clip_rects. size ( ) - 1; i >= 0; i-- ) {
194 p. fillRect ( QRect ( mapFromGlobal ( qt_bug_workaround_clip_rects [i]. topLeft ( )), qt_bug_workaround_clip_rects [i]. size ( )), QBrush ( NoBrush ) ); 195 p. fillRect ( QRect ( mapFromGlobal ( qt_bug_workaround_clip_rects [i]. topLeft ( )), qt_bug_workaround_clip_rects [i]. size ( )), QBrush ( NoBrush ) );
195 } 196 }
196 } 197 }
197 } 198 }
198 //qWarning( "painting >>>" ); 199 //qWarning( "painting >>>" );
199} 200}
@@ -203,4 +204,4 @@ void XineVideoWidget::setImage ( QImage* image )
203{ 204{
204 delete m_image; 205 delete m_image;
205 m_image = image; 206 m_image = image;
206} 207}
@@ -209,19 +210,19 @@ void XineVideoWidget::setImage ( uchar* img, int w, int h, int bpl )
209{ 210{
210 bool rot90 = (( -m_rotation ) & 1 ); 211 bool rot90 = (( -m_rotation ) & 1 );
211 212
212 if ( rot90 ) { 213 if ( rot90 ) {
213 int d = w; 214 int d = w;
214 w = h; 215 w = h;
215 h = d; 216 h = d;
216 } 217 }
217 218
218 m_lastframe = m_thisframe; 219 m_lastframe = m_thisframe;
219 m_thisframe. setRect (( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h ); 220 m_thisframe. setRect (( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h );
220 221
221 //qDebug ( "Frame: %d,%d - %dx%d", ( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h ); 222// qDebug ( "Frame: %d,%d - %dx%d", ( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h );
222 223
223 m_buff = img; 224 m_buff = img;
224 m_bytes_per_line_frame = bpl; 225 m_bytes_per_line_frame = bpl;
225 226
226 repaint ((( m_thisframe & m_lastframe ) != m_lastframe ) ? m_lastframe : m_thisframe, false ); 227 repaint ((( m_thisframe & m_lastframe ) != m_lastframe ) ? m_lastframe : m_thisframe, false );
227} 228}
@@ -230,14 +231,14 @@ void XineVideoWidget::resizeEvent ( QResizeEvent * )
230{ 231{
231 QSize s = size ( ); 232 QSize s = size ( );
232 bool fs = ( s == qApp-> desktop ( )-> size ( )); 233 bool fs = ( s == qApp-> desktop ( )-> size ( ));
233 234
234 m_rotation = fs ? -qt_screen-> transformOrientation ( ) : 0; 235 m_rotation = fs ? -qt_screen-> transformOrientation ( ) : 0;
235 236
236 if ( fs && qt_screen-> isTransformed ( )) { 237 if ( fs && qt_screen-> isTransformed ( )) {
237 s = qt_screen-> mapToDevice ( s ); 238 s = qt_screen-> mapToDevice ( s );
238 } 239 }
239 240
240 //qDebug ( "\n\nResize: %dx%d, Rot: %d", s.width(),s.height(),m_rotation ); 241// qDebug ( "\n\nResize: %dx%d, Rot: %d", s.width(),s.height(),m_rotation );
241 242
242 emit videoResized ( s ); 243 emit videoResized ( s );
243} 244}
@@ -247,9 +248,9 @@ void XineVideoWidget::mousePressEvent ( QMouseEvent *me )
247{ 248{
248 QWidget *p = parentWidget ( ); 249 QWidget *p = parentWidget ( );
249 250
250 if ( p ) { 251 if ( p ) {
251 QMouseEvent pme ( QEvent::MouseButtonPress, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); 252 QMouseEvent pme ( QEvent::MouseButtonPress, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( ));
252 253
253 QApplication::sendEvent ( p, &pme ); 254 QApplication::sendEvent ( p, &pme );
254 } 255 }
255} 256}
@@ -258,9 +259,9 @@ void XineVideoWidget::mouseReleaseEvent ( QMouseEvent *me )
258{ 259{
259 QWidget *p = parentWidget ( ); 260 QWidget *p = parentWidget ( );
260 261
261 if ( p ) { 262 if ( p ) {
262 QMouseEvent pme ( QEvent::MouseButtonRelease, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); 263 QMouseEvent pme ( QEvent::MouseButtonRelease, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( ));
263 264
264 QApplication::sendEvent ( p, &pme ); 265 QApplication::sendEvent ( p, &pme );
265 } 266 }
266} 267}