summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/videowidget.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/videowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp38
1 files changed, 23 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index bce6b89..48caf00 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -83,18 +83,23 @@ static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton));
83VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : 83VideoWidget::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 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 cfg.setGroup("AudioWidget");
96 QString skin = cfg.readEntry("Skin","default");
97 QString skinPath = "opieplayer/skins/" + skin;
98 backgroundPix = QString("%1/background").arg(skinPath) ;
99
95 setBackgroundPixmap( Resource::loadPixmap( backgroundPix) ); 100 setBackgroundPixmap( Resource::loadPixmap( backgroundPix) );
96 pixmaps[0] = new QPixmap( Resource::loadPixmap( Button0aPix ) ); 101 pixmaps[0] = new QPixmap( Resource::loadPixmap( Button0aPix ) );
97 pixmaps[1] = new QPixmap( Resource::loadPixmap( Button0bPix ) ); 102 pixmaps[1] = new QPixmap( Resource::loadPixmap( Button0bPix ) );
98 pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix) ); 103 pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix) );
99 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); 104 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 );
100 105
@@ -120,13 +125,13 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
120 setPosition( mediaPlayerState->position() ); 125 setPosition( mediaPlayerState->position() );
121 setFullscreen( mediaPlayerState->fullscreen() ); 126 setFullscreen( mediaPlayerState->fullscreen() );
122 setPaused( mediaPlayerState->paused() ); 127 setPaused( mediaPlayerState->paused() );
123 setPlaying( mediaPlayerState->playing() ); 128 setPlaying( mediaPlayerState->playing() );
124 129
125 videoFrame = new XineVideoWidget( 240, 155 ,this, "Video frame" ); 130 videoFrame = new XineVideoWidget( 240, 155 ,this, "Video frame" );
126 videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) ); 131
127} 132}
128 133
129 134
130VideoWidget::~VideoWidget() { 135VideoWidget::~VideoWidget() {
131 for ( int i = 0; i < 3; i++ ) { 136 for ( int i = 0; i < 3; i++ ) {
132 delete pixmaps[i]; 137 delete pixmaps[i];
@@ -266,36 +271,39 @@ void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
266 mouseMoveEvent( event ); 271 mouseMoveEvent( event );
267 } 272 }
268} 273}
269 274
270 275
271void VideoWidget::makeVisible() { 276void VideoWidget::makeVisible() {
272 if ( mediaPlayerState->fullscreen() ) { 277 if ( mediaPlayerState->fullscreen() ) {
273 setBackgroundMode( QWidget::NoBackground ); 278 setBackgroundMode( QWidget::NoBackground );
274 showFullScreen(); 279 showFullScreen();
275 resize( qApp->desktop()->size() ); 280 resize( qApp->desktop()->size() );
276 slider->hide(); 281 slider->hide();
277 } else { 282 } else {
278 setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); 283 setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
279 showNormal(); 284 showNormal();
280 showMaximized(); 285 showMaximized();
281 slider->show(); 286 slider->show();
282 } 287 }
283} 288}
284 289
285 290
286void VideoWidget::paintEvent( QPaintEvent * ) { 291void VideoWidget::paintEvent( QPaintEvent * ) {
287 QPainter p( this ); 292 QPainter p( this );
288 293
289 if ( mediaPlayerState->fullscreen() ) { 294 if ( mediaPlayerState->fullscreen() ) {
290 // Clear the background 295 // Clear the background
291 p.setBrush( QBrush( Qt::black ) ); 296 p.setBrush( QBrush( Qt::black ) );
292 videoFrame->setGeometry( QRect( 0, 0 , 240 ,340 ) ); 297 videoFrame->setGeometry( QRect( 0, 0 , 240 ,340 ) );
293 298
294 } else { 299 } else {
300
301 videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) );
295 // draw the buttons 302 // draw the buttons
303
296 for ( int i = 0; i < numButtons; i++ ) { 304 for ( int i = 0; i < numButtons; i++ ) {
297 paintButton( &p, i ); 305 paintButton( &p, i );
298 } 306 }
299 // draw the slider 307 // draw the slider
300 slider->repaint( TRUE ); 308 slider->repaint( TRUE );
301 } 309 }