summaryrefslogtreecommitdiff
path: root/core
authorllornkcor <llornkcor>2003-04-20 02:30:43 (UTC)
committer llornkcor <llornkcor>2003-04-20 02:30:43 (UTC)
commit845c8a880a2ff701f21c2845674e97a2493499f4 (patch) (unidiff)
treec91b65869022c2628f509cb27685e45dfb199679 /core
parentb62c40465c917e4952651b6f359e5ec76b340d3f (diff)
downloadopie-845c8a880a2ff701f21c2845674e97a2493499f4.zip
opie-845c8a880a2ff701f21c2845674e97a2493499f4.tar.gz
opie-845c8a880a2ff701f21c2845674e97a2493499f4.tar.bz2
add video skin support *finally*, fixed widget for landscape/sizing
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp35
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp923
-rw-r--r--core/multimedia/opieplayer/videowidget.h21
3 files changed, 627 insertions, 352 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 8b295b0..bffda38 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -167,6 +167,7 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
167// this , SLOT( addSelected()) ); 167// this , SLOT( addSelected()) );
168 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); 168 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close");
169 tbDeletePlaylist->setFlat(TRUE); 169 tbDeletePlaylist->setFlat(TRUE);
170
170 tbDeletePlaylist->setFixedSize(20,20); 171 tbDeletePlaylist->setFixedSize(20,20);
171 172
172 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", 173 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist",
@@ -227,10 +228,15 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
227 228
228 229
229 // Add the playlist area 230 // Add the playlist area
230 231
231 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); 232 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
232 d->playListFrame = vbox3; 233 d->playListFrame = vbox3;
233 d->playListFrame ->setMinimumSize(235,260); 234
235 QGridLayout *layoutF = new QGridLayout( pTab );
236 layoutF->setSpacing( 2);
237 layoutF->setMargin( 2);
238 layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 );
239// d->playListFrame ->setMinimumSize(235,260);
234 240
235 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); 241 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
236 242
@@ -250,7 +256,12 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
250 QWidget *aTab; 256 QWidget *aTab;
251 aTab = new QWidget( tabWidget, "aTab" ); 257 aTab = new QWidget( tabWidget, "aTab" );
252 audioView = new QListView( aTab, "Audioview" ); 258 audioView = new QListView( aTab, "Audioview" );
253 audioView->setMinimumSize(233,260); 259
260 QGridLayout *layoutA = new QGridLayout( aTab );
261 layoutA->setSpacing( 2);
262 layoutA->setMargin( 2);
263 layoutA->addMultiCellWidget( audioView, 0, 0, 0, 1 );
264
254 audioView->addColumn( tr("Title"),140); 265 audioView->addColumn( tr("Title"),140);
255 audioView->addColumn(tr("Size"), -1); 266 audioView->addColumn(tr("Size"), -1);
256 audioView->addColumn(tr("Media"),-1); 267 audioView->addColumn(tr("Media"),-1);
@@ -275,7 +286,11 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
275 QWidget *vTab; 286 QWidget *vTab;
276 vTab = new QWidget( tabWidget, "vTab" ); 287 vTab = new QWidget( tabWidget, "vTab" );
277 videoView = new QListView( vTab, "Videoview" ); 288 videoView = new QListView( vTab, "Videoview" );
278 videoView->setMinimumSize(233,260); 289
290 QGridLayout *layoutV = new QGridLayout( vTab );
291 layoutV->setSpacing( 2);
292 layoutV->setMargin( 2);
293 layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 );
279 294
280 videoView->addColumn(tr("Title"),140); 295 videoView->addColumn(tr("Title"),140);
281 videoView->addColumn(tr("Size"),-1); 296 videoView->addColumn(tr("Size"),-1);
@@ -294,7 +309,13 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
294 QWidget *LTab; 309 QWidget *LTab;
295 LTab = new QWidget( tabWidget, "LTab" ); 310 LTab = new QWidget( tabWidget, "LTab" );
296 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy 311 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy
297 playLists->setMinimumSize(233,260); 312
313 QGridLayout *layoutL = new QGridLayout( LTab );
314 layoutL->setSpacing( 2);
315 layoutL->setMargin( 2);
316 layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 );
317// playLists->setMinimumSize(233,260);
318
298 tabWidget->insertTab(LTab,tr("Lists")); 319 tabWidget->insertTab(LTab,tr("Lists"));
299 320
300 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); 321 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
@@ -321,17 +342,13 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
321 this,SLOT( playIt( QListViewItem *)) ); 342 this,SLOT( playIt( QListViewItem *)) );
322 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 343 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
323 344
324
325//playlists 345//playlists
326 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 346 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
327 347
328
329 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); 348 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
330 349
331 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 350 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
332 351
333
334
335 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); 352 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
336 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 353 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
337 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 354 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp
index 97997f9..1b38206 100644
--- a/core/multimedia/opieplayer/videowidget.cpp
+++ b/core/multimedia/opieplayer/videowidget.cpp
@@ -1,26 +1,28 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2 ** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3 **
4** This file is part of Qtopia Environment. 4 ** This file is part of Qtopia Environment.
5** 5 **
6** This file may be distributed and/or modified under the terms of the 6 ** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7 ** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8 ** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9 ** packaging of this file.
10** 10 **
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13 **
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15 **
16** Contact info@trolltech.com if any conditions of this licensing are 16 ** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17 ** not clear to you.
18** 18 **
19**********************************************************************/ 19 **********************************************************************/
20#include <qpe/resource.h> 20#include <qpe/resource.h>
21#include <qpe/mediaplayerplugininterface.h> 21#include <qpe/mediaplayerplugininterface.h>
22#include <qpe/config.h> 22#include <qpe/config.h>
23#include <qpe/qpeapplication.h>
23 24
25#include <qdir.h>
24#include <qwidget.h> 26#include <qwidget.h>
25#include <qpainter.h> 27#include <qpainter.h>
26#include <qpixmap.h> 28#include <qpixmap.h>
@@ -45,440 +47,685 @@ static const int yo = 0; // movable y offset
45 47
46 48
47struct MediaButton { 49struct MediaButton {
48 int xPos, yPos; 50// int xPos, yPos;
49 bool isToggle, isHeld, isDown; 51 bool isToggle, isHeld, isDown;
50 int controlType; 52// int controlType;
51}; 53};
52 54
53 55
54// Layout information for the videoButtons (and if it is a toggle button or not) 56// Layout information for the videoButtons (and if it is a toggle button or not)
55MediaButton videoButtons[] = { 57MediaButton videoButtons[] = {
56 { 5+0*32+xo, 200+yo, FALSE, FALSE, FALSE, 4 }, // previous 58 { FALSE, FALSE, FALSE }, // stop
57 { 5+1*32+xo, 200+yo, FALSE, FALSE, FALSE, 1 }, // stop 59 { TRUE, FALSE, FALSE }, // play
58 { 5+2*32+xo, 200+yo, TRUE, FALSE, FALSE, 0 }, // play 60 { FALSE, FALSE, FALSE }, // previous
59 { 5+3*32+xo, 200+yo, TRUE, FALSE, FALSE, 2 }, // pause 61 { FALSE, FALSE, FALSE }, // next
60 { 5+4*32+xo, 200+yo, FALSE, FALSE, FALSE, 3 }, // next 62 { FALSE, FALSE, FALSE }, // volUp
61 { 5+5*32+xo, 200+yo, FALSE, FALSE, FALSE, 8 }, // playlist 63 { FALSE, FALSE, FALSE }, // volDown
62 { 5+6*32+xo, 200+yo, TRUE, FALSE, FALSE, 9 } // fullscreen 64 { TRUE, FALSE, FALSE } // fullscreen
63}; 65};
64 66
67//static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton));
65 68
66static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 69const char *skinV_mask_file_names[7] = {
70 "stop","play","back","fwd","up","down","full"
71};
67 72
73static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton));
68 74
69VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : 75VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
70 QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { 76 QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 )
71 setCaption( tr("OpiePlayer") ); 77{
72 Config cfg("OpiePlayer"); 78 setCaption( tr("OpiePlayer") );
73 cfg.setGroup("VideoWidget"); 79 Config cfg("OpiePlayer");
74 80
75 QString backgroundPix, Button0aPix, Button0bPix, controlsPix; 81 cfg.setGroup("Options");
76 backgroundPix=cfg.readEntry( "backgroundPix", "opieplayer/metalFinish"); 82 skin = cfg.readEntry("Skin","default");
77 Button0aPix=cfg.readEntry( "Button0aPix", "opieplayer/mediaButton0a"); 83
78 Button0bPix=cfg.readEntry( "Button0bPix","opieplayer/mediaButton0b"); 84 QString skinPath;
79 controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls0" ); 85 skinPath = "opieplayer2/skins/" + skin;
80 86 if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists())
81 setBackgroundPixmap( Resource::loadPixmap( backgroundPix) ); 87 skinPath = "opieplayer2/skins/default";
82 pixmaps[0] = new QPixmap( Resource::loadPixmap( Button0aPix ) ); 88
83 pixmaps[1] = new QPixmap( Resource::loadPixmap( Button0bPix ) ); 89 qDebug("skin path " + skinPath);
84 pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix) ); 90
85 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); 91// QString skinPath = "opieplayer2/skins/" + skin;
86 92
87 slider = new QSlider( Qt::Horizontal, this ); 93 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
88 slider->setMinValue( 0 ); 94 imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
89 slider->setMaxValue( 1 ); 95 imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
90 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 96
91 slider->setFocusPolicy( QWidget::NoFocus ); 97 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
92 slider->setGeometry( QRect( 7, 250, 220, 20 ) ); 98 imgButtonMask->fill( 0 );
93 99
94 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 100 for ( int i = 0; i < 7; i++ )
95 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 101 {
96 102 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath +
97 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 103 "/skinV_mask_" + skinV_mask_file_names[i] + ".png" );
98 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 104 qDebug("loading "+filename);
99 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 105 masks[i] = new QBitmap( filename );
100 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 106
101 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); 107 if ( !masks[i]->isNull() )
102 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 108 {
103 109 QImage imgMask = masks[i]->convertToImage();
104 // Intialise state 110 uchar **dest = imgButtonMask->jumpTable();
105 setLength( mediaPlayerState->length() ); 111 for ( int y = 0; y < imgUp->height(); y++ )
106 setPosition( mediaPlayerState->position() ); 112 {
107 setFullscreen( mediaPlayerState->fullscreen() ); 113 uchar *line = dest[y];
108 setPaused( mediaPlayerState->paused() ); 114 for ( int x = 0; x < imgUp->width(); x++ )
109 setPlaying( mediaPlayerState->playing() ); 115 {
116 if ( !qRed( imgMask.pixel( x, y ) ) )
117 line[x] = i + 1;
118 }
119 }
120 }
121 }
122 qDebug("finished loading first pics");
123 for ( int i = 0; i < 7; i++ )
124 {
125 buttonPixUp[i] = NULL;
126 buttonPixDown[i] = NULL;
127 }
128
129 setBackgroundPixmap( *pixBg );
130
131 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 );
132
133 slider = new QSlider( Qt::Horizontal, this );
134 slider->setMinValue( 0 );
135 slider->setMaxValue( 1 );
136 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
137 slider->setFocusPolicy( QWidget::NoFocus );
138// slider->setGeometry( QRect( 7, 250, 220, 20 ) );
139
140 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
141 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
142
143 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
144 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
145 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
146 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
147 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
148 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
149
150 // Intialise state
151 setLength( mediaPlayerState->length() );
152 setPosition( mediaPlayerState->position() );
153 setFullscreen( mediaPlayerState->fullscreen() );
154 setPaused( mediaPlayerState->paused() );
155 setPlaying( mediaPlayerState->playing() );
110} 156}
111 157
112 158
113VideoWidget::~VideoWidget() { 159VideoWidget::~VideoWidget() {
114 for ( int i = 0; i < 3; i++ ) 160
115 delete pixmaps[i]; 161 for ( int i = 0; i < 7; i++ )
116 delete currentFrame; 162 {
163 delete buttonPixUp[i];
164 delete buttonPixDown[i];
165 }
166
167 delete pixBg;
168 delete imgUp;
169 delete imgDn;
170 delete imgButtonMask;
171 for ( int i = 0; i < 7; i++ )
172 {
173 delete masks[i];
174 }
175
176// for ( int i = 0; i < 3; i++ )
177// delete pixmaps[i];
178// delete currentFrame;
117} 179}
118 180
119 181
120static bool videoSliderBeingMoved = FALSE; 182static bool videoSliderBeingMoved = FALSE;
121 183
184QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
185 QPixmap pix( img.width(), img.height() );
186 QPainter p( &pix );
187 p.drawTiledPixmap( pix.rect(), bg, offset );
188 p.drawImage( 0, 0, img );
189 return new QPixmap( pix );
190}
191
192QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) {
193 QPixmap *pixmap = new QPixmap( pix );
194 pixmap->setMask( mask );
195 return pixmap;
196}
197
198void VideoWidget::resizeEvent( QResizeEvent * ) {
199 int h = height();
200 int w = width();
201 //int Vh = 160;
202 //int Vw = 220;
203
204 slider->setFixedWidth( w - 20 );
205 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
206 slider->setBackgroundOrigin( QWidget::ParentOrigin );
207 slider->setFocusPolicy( QWidget::NoFocus );
208 slider->setBackgroundPixmap( *pixBg );
209
210 xoff = 0;// ( imgUp->width() ) / 2;
211 if(w>h)
212 yoff = 0;
213 else
214 yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10;
215 QPoint p( xoff, yoff );
216
217 QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p );
218 QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p );
219
220 for ( int i = 0; i < 7; i++ )
221 {
222 if ( !masks[i]->isNull() )
223 {
224 delete buttonPixUp[i];
225 delete buttonPixDown[i];
226 buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] );
227 buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] );
228 }
229 }
230
231 delete pixUp;
232 delete pixDn;
233}
234
122 235
123void VideoWidget::sliderPressed() { 236void VideoWidget::sliderPressed() {
124 videoSliderBeingMoved = TRUE; 237 videoSliderBeingMoved = TRUE;
125} 238}
126 239
127 240
128void VideoWidget::sliderReleased() { 241void VideoWidget::sliderReleased() {
129 videoSliderBeingMoved = FALSE; 242 videoSliderBeingMoved = FALSE;
130 if ( slider->width() == 0 ) 243 if ( slider->width() == 0 )
131 return; 244 return;
132 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); 245 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width());
133 mediaPlayerState->setPosition( val ); 246 mediaPlayerState->setPosition( val );
134} 247}
135 248
136 249
137void VideoWidget::setPosition( long i ) { 250void VideoWidget::setPosition( long i ) {
138 updateSlider( i, mediaPlayerState->length() ); 251 updateSlider( i, mediaPlayerState->length() );
139} 252}
140 253
141 254
142void VideoWidget::setLength( long max ) { 255void VideoWidget::setLength( long max ) {
143 updateSlider( mediaPlayerState->position(), max ); 256 updateSlider( mediaPlayerState->position(), max );
144} 257}
145 258
146 259
147void VideoWidget::setView( char view ) { 260void VideoWidget::setView( char view ) {
148 if ( view == 'v' ) { 261 if ( view == 'v' )
149 makeVisible(); 262 {
150 } else { 263 makeVisible();
151 // Effectively blank the view next time we show it so it looks nicer 264 }
152 scaledWidth = 0; 265 else
153 scaledHeight = 0; 266 {
154 hide(); 267 // Effectively blank the view next time we show it so it looks nicer
155 } 268 scaledWidth = 0;
269 scaledHeight = 0;
270 hide();
271 }
156} 272}
157 273
158 274
159void VideoWidget::updateSlider( long i, long max ) { 275void VideoWidget::updateSlider( long i, long max ) {
160 // Will flicker too much if we don't do this 276 // Will flicker too much if we don't do this
161 if ( max == 0 ) 277 if ( max == 0 )
162 return; 278 return;
163 int width = slider->width(); 279 int width = slider->width();
164 int val = int((double)i * width / max); 280 int val = int((double)i * width / max);
165 if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) { 281 if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved )
166 if ( slider->value() != val ) 282 {
167 slider->setValue( val ); 283 if ( slider->value() != val )
168 if ( slider->maxValue() != width ) 284 slider->setValue( val );
169 slider->setMaxValue( width ); 285 if ( slider->maxValue() != width )
170 } 286 slider->setMaxValue( width );
287 }
171} 288}
172 289
173 290
174void VideoWidget::setToggleButton( int i, bool down ) { 291void VideoWidget::setToggleButton( int i, bool down ) {
175 if ( down != videoButtons[i].isDown ) 292 if ( down != videoButtons[i].isDown )
176 toggleButton( i ); 293 toggleButton( i );
177} 294}
178 295
179 296
180void VideoWidget::toggleButton( int i ) { 297void VideoWidget::toggleButton( int i ) {
181 videoButtons[i].isDown = !videoButtons[i].isDown; 298 videoButtons[i].isDown = !videoButtons[i].isDown;
182 QPainter p(this); 299 QPainter p(this);
183 paintButton ( &p, i ); 300 paintButton ( &p, i );
184} 301}
185 302
186 303
187void VideoWidget::paintButton( QPainter *p, int i ) { 304void VideoWidget::paintButton( QPainter *p, int i ) {
188 int x = videoButtons[i].xPos; 305 if ( videoButtons[i].isDown )
189 int y = videoButtons[i].yPos; 306 {
190 int offset = 10 + videoButtons[i].isDown; 307 p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
191 p->drawPixmap( x, y, *pixmaps[videoButtons[i].isDown] ); 308 }
192 p->drawPixmap( x + 1 + offset, y + offset, *pixmaps[2], 9 * videoButtons[i].controlType, 0, 9, 9 ); 309 else
310 {
311 p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
312 }
313// int x = videoButtons[i].xPos;
314// int y = videoButtons[i].yPos;
315// int offset = 10 + videoButtons[i].isDown;
316// p->drawPixmap( x, y, *pixmaps[videoButtons[i].isDown] );
317// p->drawPixmap( x + 1 + offset, y + offset, *pixmaps[2], 9 * videoButtons[i].controlType, 0, 9, 9 );
193} 318}
194 319
195 320
196void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 321void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
197 for ( int i = 0; i < numButtons; i++ ) { 322
198 int x = videoButtons[i].xPos; 323 for ( int i = 0; i < numVButtons; i++ )
199 int y = videoButtons[i].yPos; 324 {
200 if ( event->state() == QMouseEvent::LeftButton ) { 325 if ( event->state() == QMouseEvent::LeftButton )
201 // The test to see if the mouse click is inside the circular button or not 326 {
202 // (compared with the radius squared to avoid a square-root of our distance) 327 // The test to see if the mouse click is inside the button or not
203 int radius = 16; 328 int x = event->pos().x() - xoff;
204 QPoint center = QPoint( x + radius, y + radius ); 329 int y = event->pos().y() - yoff;
205 QPoint dXY = center - event->pos(); 330
206 int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); 331 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
207 bool isOnButton = dist <= (radius * radius); 332 && y < imgButtonMask->height()
208 if ( isOnButton != videoButtons[i].isHeld ) { 333 && imgButtonMask->pixelIndex( x, y ) == i + 1 );
209 videoButtons[i].isHeld = isOnButton; 334
210 toggleButton(i); 335 if ( isOnButton && !videoButtons[i].isHeld )
336 {
337 videoButtons[i].isHeld = TRUE;
338 toggleButton(i);
339
340// switch (i) {
341// case VideoVolUp:
342// emit moreClicked();
343// return;
344// case VideoVolDown:
345// emit lessClicked();
346// return;
347// }
348 }
349 else if ( !isOnButton && videoButtons[i].isHeld )
350 {
351 videoButtons[i].isHeld = FALSE;
352 toggleButton(i);
353 }
354 }
355 else
356 {
357
358 if ( videoButtons[i].isHeld )
359 {
360 videoButtons[i].isHeld = FALSE;
361 if ( !videoButtons[i].isToggle )
362 {
363 setToggleButton( i, FALSE );
211 } 364 }
212 } else { 365 qDebug("key %d", i);
213 if ( videoButtons[i].isHeld ) { 366 switch(i)
214 videoButtons[i].isHeld = FALSE; 367 {
215 if ( !videoButtons[i].isToggle ) 368// case VideoPlay:
216 setToggleButton( i, FALSE ); 369// {
370// if( mediaPlayerState->isPaused )
371// {
372// setToggleButton( i, FALSE );
373// mediaPlayerState->setPaused( FALSE );
374// return;
375// }
376// else if( !mediaPlayerState->isPaused )
377// {
378// setToggleButton( i, TRUE );
379// mediaPlayerState->setPaused( TRUE );
380// return;
381// }
382// else
383// {
384// return;
385// }
386// }
387
388 case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return;
389 case VideoStop: mediaPlayerState->setPlaying(FALSE); return;
390// case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return;
391 case VideoNext: mediaPlayerState->setNext(); return;
392 case VideoPrevious: mediaPlayerState->setPrev(); return;
393// case VideoPlayList: mediaPlayerState->setList(); return;
394 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
395
396// case VideoStop: mediaPlayerState->setPlaying( FALSE ); return;
397// case VideoNext: if(playList->whichList() ==0) mediaPlayerState->setNext(); return;
398// case VideoPrevious: if(playList->whichList() ==0) mediaPlayerState->setPrev(); return;
399// case VideoVolUp: emit moreReleased(); return;
400// case VideoVolDown: emit lessReleased(); return;
401// case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
217 } 402 }
218 } 403 }
219 switch (i) { 404 }
220 case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; 405 }
221 case VideoStop: mediaPlayerState->setPlaying(FALSE); return; 406
222 case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; 407
223 case VideoNext: mediaPlayerState->setNext(); return; 408
224 case VideoPrevious: mediaPlayerState->setPrev(); return; 409
225 case VideoPlayList: mediaPlayerState->setList(); return; 410
226 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; 411
227 } 412// for ( int i = 0; i < numButtons; i++ ) {
228 413// int x = videoButtons[i].xPos;
229 } 414// int y = videoButtons[i].yPos;
415// if ( event->state() == QMouseEvent::LeftButton ) {
416// // The test to see if the mouse click is inside the circular button or not
417// // (compared with the radius squared to avoid a square-root of our distance)
418// int radius = 16;
419// QPoint center = QPoint( x + radius, y + radius );
420// QPoint dXY = center - event->pos();
421// int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y();
422// bool isOnButton = dist <= (radius * radius);
423// if ( isOnButton != videoButtons[i].isHeld ) {
424// videoButtons[i].isHeld = isOnButton;
425// toggleButton(i);
426// }
427// } else {
428// if ( videoButtons[i].isHeld ) {
429// videoButtons[i].isHeld = FALSE;
430// if ( !videoButtons[i].isToggle )
431// setToggleButton( i, FALSE );
432// }
433// }
434
435// switch (i) {
436// case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return;
437// case VideoStop: mediaPlayerState->setPlaying(FALSE); return;
438// case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return;
439// case VideoNext: mediaPlayerState->setNext(); return;
440// case VideoPrevious: mediaPlayerState->setPrev(); return;
441// case VideoPlayList: mediaPlayerState->setList(); return;
442// case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
443// }
444
445// }
230} 446}
231 447
232 448
233void VideoWidget::mousePressEvent( QMouseEvent *event ) { 449void VideoWidget::mousePressEvent( QMouseEvent *event ) {
234 mouseMoveEvent( event ); 450 mouseMoveEvent( event );
235} 451}
236 452
237 453
238void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 454void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
239 if ( mediaPlayerState->fullscreen() ) { 455 if ( mediaPlayerState->fullscreen() )
240 mediaPlayerState->setFullscreen( FALSE ); 456 {
241 makeVisible(); 457 mediaPlayerState->setFullscreen( FALSE );
458 makeVisible();
242 459
243 mouseMoveEvent( event ); 460 mouseMoveEvent( event );
244 } 461 }
245} 462}
246 463
247 464
248void VideoWidget::makeVisible() { 465void VideoWidget::makeVisible() {
249 if ( mediaPlayerState->fullscreen() ) { 466 if ( mediaPlayerState->fullscreen() )
250 setBackgroundMode( QWidget::NoBackground ); 467 {
251 showFullScreen(); 468 setBackgroundMode( QWidget::NoBackground );
252 resize( qApp->desktop()->size() ); 469 showFullScreen();
253 slider->hide(); 470 resize( qApp->desktop()->size() );
254 } else { 471 slider->hide();
255 setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); 472 }
256 showNormal(); 473 else
257 showMaximized(); 474 {
258 slider->show(); 475 setBackgroundPixmap( *pixBg );
259 } 476 showNormal();
477 showMaximized();
478 slider->show();
479 }
260} 480}
261 481
262 482
263void VideoWidget::paintEvent( QPaintEvent * ) { 483void VideoWidget::paintEvent( QPaintEvent * pe) {
264 QPainter p( this ); 484 QPainter p( this );
265
266 if ( mediaPlayerState->fullscreen() ) {
267 // Clear the background
268 p.setBrush( QBrush( Qt::black ) );
269 p.drawRect( rect() );
270 485
271 // Draw the current frame 486 if ( mediaPlayerState->fullscreen() ) {
272 //p.drawImage( ); // If using directpainter we won't have a copy except whats on the screen 487 // Clear the background
273 } else { 488 p.setBrush( QBrush( Qt::black ) );
274 // draw border 489 p.drawRect( rect() );
275 qDrawShadePanel( &p, 4, 15, 230, 170, colorGroup(), TRUE, 5, NULL ); 490 } else {
276 491 if ( !pe->erased() ) {
277 // Clear the movie screen first 492 // Combine with background and double buffer
278 p.setBrush( QBrush( Qt::black ) ); 493 QPixmap pix( pe->rect().size() );
279 p.drawRect( 9, 20, 220, 160 ); 494 QPainter p( &pix );
280 495 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
281 // draw current frame (centrally positioned from scaling to maintain aspect ratio) 496 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
282 p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); 497 for ( int i = 0; i < numVButtons; i++ ) {
283 498 paintButton( &p, i );
284 // draw the buttons 499 }
285 for ( int i = 0; i < numButtons; i++ ) 500 QPainter p2( this );
286 paintButton( &p, i ); 501 p2.drawPixmap( pe->rect().topLeft(), pix );
287 502 } else {
288 // draw the slider 503 QPainter p( this );
289 slider->repaint( TRUE ); 504 for ( int i = 0; i < numVButtons; i++ )
290 } 505 paintButton( &p, i );
506 }
507 slider->repaint( TRUE );
508 }
291} 509}
292 510
293 511
294void VideoWidget::closeEvent( QCloseEvent* ) { 512void VideoWidget::closeEvent( QCloseEvent* ) {
295 mediaPlayerState->setList(); 513 mediaPlayerState->setList();
296} 514}
297 515
298 516
299bool VideoWidget::playVideo() { 517bool VideoWidget::playVideo() {
300 bool result = FALSE; 518 bool result = FALSE;
301 519// qDebug("<<<<<<<<<<<<<<<< play video");
302 int stream = 0; 520 int stream = 0;
303 521
304 int sw = mediaPlayerState->curDecoder()->videoWidth( stream ); 522 int sw = mediaPlayerState->curDecoder()->videoWidth( stream );
305 int sh = mediaPlayerState->curDecoder()->videoHeight( stream ); 523 int sh = mediaPlayerState->curDecoder()->videoHeight( stream );
306 int dd = QPixmap::defaultDepth(); 524 int dd = QPixmap::defaultDepth();
307 int w = height(); 525 int w = height();
308 int h = width(); 526 int h = width();
309 527
310 ColorFormat format = (dd == 16) ? RGB565 : BGRA8888; 528 ColorFormat format = (dd == 16) ? RGB565 : BGRA8888;
311 529
312 if ( mediaPlayerState->fullscreen() ) { 530 if ( mediaPlayerState->fullscreen() )
531 {
313#ifdef USE_DIRECT_PAINTER 532#ifdef USE_DIRECT_PAINTER
314 QDirectPainter p(this); 533 QDirectPainter p(this);
315 534
316 if ( ( qt_screen->transformOrientation() == 3 ) && 535 if ( ( qt_screen->transformOrientation() == 3 ) &&
317 ( ( dd == 16 ) || ( dd == 32 ) ) && ( p.numRects() == 1 ) ) { 536 ( ( dd == 16 ) || ( dd == 32 ) ) && ( p.numRects() == 1 ) )
318 537 {
319 w = 320; 538
320 h = 240; 539 w = 320;
321 540 h = 240;
322 if ( mediaPlayerState->scaled() ) { 541
323 // maintain aspect ratio 542 if ( mediaPlayerState->scaled() )
324 if ( w * sh > sw * h ) 543 {
325 w = sw * h / sh; 544 // maintain aspect ratio
326 else 545 if ( w * sh > sw * h )
327 h = sh * w / sw; 546 w = sw * h / sh;
328 } else { 547 else
329 w = sw; 548 h = sh * w / sw;
330 h = sh; 549 }
550 else
551 {
552 w = sw;
553 h = sh;
554 }
555
556 w--; // we can't allow libmpeg to overwrite.
557 QPoint roff = qt_screen->mapToDevice( p.offset(), QSize( qt_screen->width(), qt_screen->height() ) );
558
559 int ox = roff.x() - height() + 2 + (height() - w) / 2;
560 int oy = roff.y() + (width() - h) / 2;
561 int sx = 0, sy = 0;
562
563 uchar* fp = p.frameBuffer() + p.lineStep() * oy;
564 fp += dd * ox / 8;
565 uchar **jt = new uchar*[h];
566
567 for ( int i = h; i; i-- )
568 {
569 jt[h - i] = fp;
570 fp += p.lineStep();
571 }
572
573 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( jt, sx, sy, sw, sh, w, h, format, 0) == 0;
574
575 delete [] jt;
331 } 576 }
577 else
578 {
579#endif
580 QPainter p(this);
581
582 w = 320;
583 h = 240;
584
585 if ( mediaPlayerState->scaled() )
586 {
587 // maintain aspect ratio
588 if ( w * sh > sw * h )
589 w = sw * h / sh;
590 else
591 h = sh * w / sw;
592 }
593 else
594 {
595 w = sw;
596 h = sh;
597 }
598
599 int bytes = ( dd == 16 ) ? 2 : 4;
600 QImage tempFrame( w, h, bytes << 3 );
601 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( tempFrame.jumpTable(),
602 0, 0, sw, sh, w, h, format, 0) == 0;
603
604 if ( result && mediaPlayerState->fullscreen() )
605 {
606
607 int rw = h, rh = w;
608 QImage rotatedFrame( rw, rh, bytes << 3 );
609
610 ushort* in = (ushort*)tempFrame.bits();
611 ushort* out = (ushort*)rotatedFrame.bits();
612 int spl = rotatedFrame.bytesPerLine() / bytes;
613
614 for (int x=0; x<h; x++)
615 {
616 if ( bytes == 2 )
617 {
618 ushort* lout = out++ + (w - 1)*spl;
619 for (int y=0; y<w; y++) {
620 *lout=*in++;
621 lout-=spl;
622 }
623 }
624 else
625 {
626 ulong* lout = ((ulong *)out)++ + (w - 1)*spl;
627 for (int y=0; y<w; y++)
628 {
629 *lout=*((ulong*)in)++;
630 lout-=spl;
631 }
632 }
633 }
332 634
333 w--; // we can't allow libmpeg to overwrite. 635 p.drawImage( (240 - rw) / 2, (320 - rh) / 2, rotatedFrame, 0, 0, rw, rh );
334 QPoint roff = qt_screen->mapToDevice( p.offset(), QSize( qt_screen->width(), qt_screen->height() ) ); 636 }
335 637#ifdef USE_DIRECT_PAINTER
336 int ox = roff.x() - height() + 2 + (height() - w) / 2;
337 int oy = roff.y() + (width() - h) / 2;
338 int sx = 0, sy = 0;
339
340 uchar* fp = p.frameBuffer() + p.lineStep() * oy;
341 fp += dd * ox / 8;
342 uchar **jt = new uchar*[h];
343 for ( int i = h; i; i-- ) {
344 jt[h - i] = fp;
345 fp += p.lineStep();
346 } 638 }
347
348 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( jt, sx, sy, sw, sh, w, h, format, 0) == 0;
349
350 delete [] jt;
351 } else {
352#endif 639#endif
353 QPainter p(this); 640 }
354 641 else
355 w = 320; 642 {
356 h = 240; 643
357 644 w = 220;
358 if ( mediaPlayerState->scaled() ) { 645 h = 160;
359 // maintain aspect ratio 646
360 if ( w * sh > sw * h ) 647 // maintain aspect ratio
361 w = sw * h / sh; 648 if ( w * sh > sw * h )
362 else 649 w = sw * h / sh;
363 h = sh * w / sw; 650 else
364 } else { 651 h = sh * w / sw;
365 w = sw; 652
366 h = sh; 653 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( currentFrame->jumpTable(), 0, 0, sw, sh, w, h, format, 0) == 0;
654
655 QPainter p( this );
656 int deskW = qApp->desktop()->width();
657 // Image changed size, therefore need to blank the possibly unpainted regions first
658 if ( scaledWidth != w || scaledHeight != h )
659 {
660 p.setBrush( QBrush( Qt::black ) );
661 p.drawRect( ( deskW -scaledWidth)/2, 20, scaledWidth, 160 );
367 } 662 }
368 663
369 int bytes = ( dd == 16 ) ? 2 : 4; 664 scaledWidth = w;
370 QImage tempFrame( w, h, bytes << 3 ); 665 scaledHeight = h;
371 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( tempFrame.jumpTable(),
372 0, 0, sw, sh, w, h, format, 0) == 0;
373 if ( result && mediaPlayerState->fullscreen() ) {
374
375 int rw = h, rh = w;
376 QImage rotatedFrame( rw, rh, bytes << 3 );
377
378 ushort* in = (ushort*)tempFrame.bits();
379 ushort* out = (ushort*)rotatedFrame.bits();
380 int spl = rotatedFrame.bytesPerLine() / bytes;
381 for (int x=0; x<h; x++) {
382 if ( bytes == 2 ) {
383 ushort* lout = out++ + (w - 1)*spl;
384 for (int y=0; y<w; y++) {
385 *lout=*in++;
386 lout-=spl;
387 }
388 } else {
389 ulong* lout = ((ulong *)out)++ + (w - 1)*spl;
390 for (int y=0; y<w; y++) {
391 *lout=*((ulong*)in)++;
392 lout-=spl;
393 }
394 }
395 }
396 666
397 p.drawImage( (240 - rw) / 2, (320 - rh) / 2, rotatedFrame, 0, 0, rw, rh ); 667 if ( result )
668 {
669 p.drawImage( (deskW - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight );
398 } 670 }
399#ifdef USE_DIRECT_PAINTER
400 }
401#endif
402 } else {
403
404 w = 220;
405 h = 160;
406 671
407 // maintain aspect ratio 672 }
408 if ( w * sh > sw * h )
409 w = sw * h / sh;
410 else
411 h = sh * w / sw;
412 673
413 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( currentFrame->jumpTable(), 0, 0, sw, sh, w, h, format, 0) == 0; 674 return result;
414
415 QPainter p( this );
416
417 // Image changed size, therefore need to blank the possibly unpainted regions first
418 if ( scaledWidth != w || scaledHeight != h ) {
419 p.setBrush( QBrush( Qt::black ) );
420 p.drawRect( 9, 20, 220, 160 );
421 }
422
423 scaledWidth = w;
424 scaledHeight = h;
425
426 if ( result ) {
427 p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight );
428 }
429
430 }
431
432 return result;
433} 675}
434 676
435 677
436 678
437void VideoWidget::keyReleaseEvent( QKeyEvent *e) 679void VideoWidget::keyReleaseEvent( QKeyEvent *e)
438{ 680{
439 switch ( e->key() ) { 681 switch ( e->key() )
682 {
440////////////////////////////// Zaurus keys 683////////////////////////////// Zaurus keys
441 case Key_Home: 684 case Key_Home:
442 break; 685 break;
443 case Key_F9: //activity 686 case Key_F9: //activity
444 break; 687 break;
445 case Key_F10: //contacts 688 case Key_F10: //contacts
446// hide(); 689// hide();
447 break; 690 break;
448 case Key_F11: //menu 691 case Key_F11: //menu
449 break; 692 break;
450 case Key_F12: //home 693 case Key_F12: //home
451 break; 694 break;
452 case Key_F13: //mail 695 case Key_F13: //mail
453 break; 696 break;
454 case Key_Space: { 697 case Key_Space:
455 if(mediaPlayerState->playing()) { 698 {
456 mediaPlayerState->setPlaying(FALSE); 699 if(mediaPlayerState->playing())
457 } else { 700 {
458 mediaPlayerState->setPlaying(TRUE); 701 mediaPlayerState->setPlaying(FALSE);
459 } 702 }
703 else
704 {
705 mediaPlayerState->setPlaying(TRUE);
460 } 706 }
461 break; 707 }
462 case Key_Down: 708 break;
709 case Key_Down:
463// toggleButton(6); 710// toggleButton(6);
464// emit lessClicked(); 711// emit lessClicked();
465// emit lessReleased(); 712// emit lessReleased();
466// toggleButton(6); 713// toggleButton(6);
467 break; 714 break;
468 case Key_Up: 715 case Key_Up:
469// toggleButton(5); 716// toggleButton(5);
470// emit moreClicked(); 717// emit moreClicked();
471// emit moreReleased(); 718// emit moreReleased();
472// toggleButton(5); 719// toggleButton(5);
473 break; 720 break;
474 case Key_Right: 721 case Key_Right:
475 mediaPlayerState->setNext(); 722 mediaPlayerState->setNext();
476 break; 723 break;
477 case Key_Left: 724 case Key_Left:
478 mediaPlayerState->setPrev(); 725 mediaPlayerState->setPrev();
479 break; 726 break;
480 case Key_Escape: 727 case Key_Escape:
481 break; 728 break;
482 729
483 }; 730 };
484} 731}
diff --git a/core/multimedia/opieplayer/videowidget.h b/core/multimedia/opieplayer/videowidget.h
index fe56ca1..fd86cd2 100644
--- a/core/multimedia/opieplayer/videowidget.h
+++ b/core/multimedia/opieplayer/videowidget.h
@@ -37,7 +37,6 @@ enum VideoButtons {
37 VideoFullscreen 37 VideoFullscreen
38}; 38};
39 39
40
41class VideoWidget : public QWidget { 40class VideoWidget : public QWidget {
42 Q_OBJECT 41 Q_OBJECT
43public: 42public:
@@ -62,6 +61,7 @@ signals:
62 void sliderMoved( long ); 61 void sliderMoved( long );
63 62
64protected: 63protected:
64 void resizeEvent( QResizeEvent * );
65 void paintEvent( QPaintEvent *pe ); 65 void paintEvent( QPaintEvent *pe );
66 void mouseMoveEvent( QMouseEvent *event ); 66 void mouseMoveEvent( QMouseEvent *event );
67 void mousePressEvent( QMouseEvent *event ); 67 void mousePressEvent( QMouseEvent *event );
@@ -70,15 +70,26 @@ protected:
70 void keyReleaseEvent( QKeyEvent *e); 70 void keyReleaseEvent( QKeyEvent *e);
71 71
72private: 72private:
73 void paintButton( QPainter *p, int i ); 73 QPixmap *pixBg;
74 void toggleButton( int ); 74 QImage *imgUp;
75 void setToggleButton( int, bool ); 75 QImage *imgDn;
76 76 QImage *imgButtonMask;
77 QBitmap *masks[7];
78 QString backgroundPix;
79 QPixmap *buttonPixUp[7];
80 QPixmap *buttonPixDown[7];
81 QString skin;
77 QSlider *slider; 82 QSlider *slider;
78 QPixmap *pixmaps[3]; 83 QPixmap *pixmaps[3];
79 QImage *currentFrame; 84 QImage *currentFrame;
85 int xoff, yoff;
80 int scaledWidth; 86 int scaledWidth;
81 int scaledHeight; 87 int scaledHeight;
88
89 void paintButton( QPainter *p, int i );
90 void toggleButton( int );
91 void setToggleButton( int, bool );
92
82}; 93};
83 94
84 95