summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-09 16:46:49 (UTC)
committer simon <simon>2002-12-09 16:46:49 (UTC)
commit73278bac12a0af959fde6d12280ed08859a5abaf (patch) (unidiff)
tree5b6bb36801b1da079f6a3dbf31fe4173dd2ec7ba
parentdbe0046eb82c8ee61ce7fc704d3b376730abc17f (diff)
downloadopie-73278bac12a0af959fde6d12280ed08859a5abaf.zip
opie-73278bac12a0af959fde6d12280ed08859a5abaf.tar.gz
opie-73278bac12a0af959fde6d12280ed08859a5abaf.tar.bz2
- another global variable removed
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 41844e1..26777e6 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -1,376 +1,374 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
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/qpeapplication.h> 34#include <qpe/qpeapplication.h>
35#include <qpe/resource.h> 35#include <qpe/resource.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37 37
38 38
39#include <qwidget.h> 39#include <qwidget.h>
40#include <qpainter.h> 40#include <qpainter.h>
41#include <qpixmap.h> 41#include <qpixmap.h>
42#include <qslider.h> 42#include <qslider.h>
43#include <qdrawutil.h> 43#include <qdrawutil.h>
44#include "videowidget.h" 44#include "videowidget.h"
45#include "mediaplayerstate.h" 45#include "mediaplayerstate.h"
46#include "playlistwidget.h" 46#include "playlistwidget.h"
47 47
48 48
49#ifdef Q_WS_QWS 49#ifdef Q_WS_QWS
50# define USE_DIRECT_PAINTER 50# define USE_DIRECT_PAINTER
51# include <qdirectpainter_qws.h> 51# include <qdirectpainter_qws.h>
52# include <qgfxraster_qws.h> 52# include <qgfxraster_qws.h>
53#endif 53#endif
54 54
55 55
56namespace 56namespace
57{ 57{
58 58
59const int xo = 2; // movable x offset 59const int xo = 2; // movable x offset
60const int yo = 0; // movable y offset 60const int yo = 0; // movable y offset
61 61
62const MediaWidget::SkinButtonInfo skinInfo[] = 62const MediaWidget::SkinButtonInfo skinInfo[] =
63{ 63{
64 { MediaWidget::Play, "play", MediaWidget::ToggleButton }, 64 { MediaWidget::Play, "play", MediaWidget::ToggleButton },
65 { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, 65 { MediaWidget::Stop, "stop", MediaWidget::NormalButton },
66 { MediaWidget::Next, "fwd", MediaWidget::NormalButton }, 66 { MediaWidget::Next, "fwd", MediaWidget::NormalButton },
67 { MediaWidget::Previous, "back", MediaWidget::NormalButton }, 67 { MediaWidget::Previous, "back", MediaWidget::NormalButton },
68 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, 68 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton },
69 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, 69 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton },
70 { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton } 70 { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton }
71}; 71};
72 72
73const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); 73const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] );
74 74
75} 75}
76 76
77VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 77VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
78 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) 78 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false )
79{ 79{
80 setCaption( tr("OpiePlayer - Video") ); 80 setCaption( tr("OpiePlayer - Video") );
81 81
82 82
83 videoFrame = new XineVideoWidget ( this, "Video frame" ); 83 videoFrame = new XineVideoWidget ( this, "Video frame" );
84 84
85 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 85 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
86 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 86 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
87 87
88 Config cfg("OpiePlayer"); 88 Config cfg("OpiePlayer");
89 cfg.setGroup("Options"); 89 cfg.setGroup("Options");
90 skin = cfg.readEntry("Skin","default"); 90 skin = cfg.readEntry("Skin","default");
91 91
92 QString skinPath = "opieplayer2/skins/" + skin; 92 QString skinPath = "opieplayer2/skins/" + skin;
93 backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 93 backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
94 imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); 94 imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
95 imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); 95 imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
96 96
97 buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); 97 buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
98 buttonMask.fill( 0 ); 98 buttonMask.fill( 0 );
99 99
100 for ( uint i = 0; i < buttonCount; i++ ) { 100 for ( uint i = 0; i < buttonCount; i++ ) {
101 Button button; 101 Button button;
102 button.command = skinInfo[ i ].command; 102 button.command = skinInfo[ i ].command;
103 button.type = skinInfo[ i ].type; 103 button.type = skinInfo[ i ].type;
104 104
105 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinInfo[i].fileName + ".png" ); 105 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinInfo[i].fileName + ".png" );
106 button.mask =QBitmap( filename ); 106 button.mask =QBitmap( filename );
107 107
108 if ( !button.mask.isNull() ) { 108 if ( !button.mask.isNull() ) {
109 QImage imgMask = button.mask.convertToImage(); 109 QImage imgMask = button.mask.convertToImage();
110 uchar **dest = buttonMask.jumpTable(); 110 uchar **dest = buttonMask.jumpTable();
111 for ( int y = 0; y < imgUp.height(); y++ ) { 111 for ( int y = 0; y < imgUp.height(); y++ ) {
112 uchar *line = dest[y]; 112 uchar *line = dest[y];
113 for ( int x = 0; x < imgUp.width(); x++ ) 113 for ( int x = 0; x < imgUp.width(); x++ )
114 if ( !qRed( imgMask.pixel( x, y ) ) ) 114 if ( !qRed( imgMask.pixel( x, y ) ) )
115 line[x] = button.command + 1; 115 line[x] = button.command + 1;
116 } 116 }
117 } 117 }
118 118
119 buttons.push_back( button ); 119 buttons.push_back( button );
120 } 120 }
121 121
122 setBackgroundPixmap( backgroundPixmap ); 122 setBackgroundPixmap( backgroundPixmap );
123 123
124 slider = new QSlider( Qt::Horizontal, this ); 124 slider = new QSlider( Qt::Horizontal, this );
125 slider->setMinValue( 0 ); 125 slider->setMinValue( 0 );
126 slider->setMaxValue( 1 ); 126 slider->setMaxValue( 1 );
127 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 127 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
128 //slider->setFocusPolicy( QWidget::NoFocus ); 128 //slider->setFocusPolicy( QWidget::NoFocus );
129 129
130 resizeEvent( NULL ); 130 resizeEvent( NULL );
131 131
132 setLength( mediaPlayerState.length() ); 132 setLength( mediaPlayerState.length() );
133 setPosition( mediaPlayerState.position() ); 133 setPosition( mediaPlayerState.position() );
134 setFullscreen( mediaPlayerState.isFullscreen() ); 134 setFullscreen( mediaPlayerState.isFullscreen() );
135 setPlaying( mediaPlayerState.isPlaying() ); 135 setPlaying( mediaPlayerState.isPlaying() );
136} 136}
137 137
138 138
139VideoWidget::~VideoWidget() 139VideoWidget::~VideoWidget()
140{ 140{
141} 141}
142 142
143QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 143QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
144 QPixmap pix( img.width(), img.height() ); 144 QPixmap pix( img.width(), img.height() );
145 QPainter p( &pix ); 145 QPainter p( &pix );
146 p.drawTiledPixmap( pix.rect(), bg, offset ); 146 p.drawTiledPixmap( pix.rect(), bg, offset );
147 p.drawImage( 0, 0, img ); 147 p.drawImage( 0, 0, img );
148 return new QPixmap( pix ); 148 return new QPixmap( pix );
149} 149}
150 150
151QPixmap maskVPixToMask( QPixmap pix, QBitmap mask ) { 151QPixmap maskVPixToMask( QPixmap pix, QBitmap mask ) {
152 QPixmap pixmap( pix ); 152 QPixmap pixmap( pix );
153 pixmap.setMask( mask ); 153 pixmap.setMask( mask );
154 return pixmap; 154 return pixmap;
155} 155}
156 156
157void VideoWidget::resizeEvent( QResizeEvent * ) { 157void VideoWidget::resizeEvent( QResizeEvent * ) {
158 int h = height(); 158 int h = height();
159 int w = width(); 159 int w = width();
160 //int Vh = 160; 160 //int Vh = 160;
161 //int Vw = 220; 161 //int Vw = 220;
162 162
163 slider->setFixedWidth( w - 20 ); 163 slider->setFixedWidth( w - 20 );
164 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 164 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
165 slider->setBackgroundOrigin( QWidget::ParentOrigin ); 165 slider->setBackgroundOrigin( QWidget::ParentOrigin );
166 slider->setFocusPolicy( QWidget::NoFocus ); 166 slider->setFocusPolicy( QWidget::NoFocus );
167 slider->setBackgroundPixmap( backgroundPixmap ); 167 slider->setBackgroundPixmap( backgroundPixmap );
168 168
169 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; 169 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2;
170 if(w>h) 170 if(w>h)
171 upperLeftOfButtonMask.ry() = 0; 171 upperLeftOfButtonMask.ry() = 0;
172 else 172 else
173 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; 173 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10;
174 QPoint p = upperLeftOfButtonMask; 174 QPoint p = upperLeftOfButtonMask;
175 175
176 QPixmap *pixUp = combineVImageWithBackground( imgUp, backgroundPixmap, p ); 176 QPixmap *pixUp = combineVImageWithBackground( imgUp, backgroundPixmap, p );
177 QPixmap *pixDn = combineVImageWithBackground( imgDn, backgroundPixmap, p ); 177 QPixmap *pixDn = combineVImageWithBackground( imgDn, backgroundPixmap, p );
178 178
179 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { 179 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) {
180 Button &button = *it; 180 Button &button = *it;
181 181
182 if ( !button.mask.isNull() ) { 182 if ( !button.mask.isNull() ) {
183 button.pixUp = maskVPixToMask( *pixUp, button.mask ); 183 button.pixUp = maskVPixToMask( *pixUp, button.mask );
184 button.pixDown = maskVPixToMask( *pixDn, button.mask ); 184 button.pixDown = maskVPixToMask( *pixDn, button.mask );
185 } 185 }
186 } 186 }
187 187
188 delete pixUp; 188 delete pixUp;
189 delete pixDn; 189 delete pixDn;
190} 190}
191 191
192static bool videoSliderBeingMoved = FALSE;
193
194void VideoWidget::sliderPressed() { 192void VideoWidget::sliderPressed() {
195 videoSliderBeingMoved = TRUE; 193 videoSliderBeingMoved = TRUE;
196} 194}
197 195
198void VideoWidget::sliderReleased() { 196void VideoWidget::sliderReleased() {
199 videoSliderBeingMoved = FALSE; 197 videoSliderBeingMoved = FALSE;
200 if ( slider->width() == 0 ) { 198 if ( slider->width() == 0 ) {
201 return; 199 return;
202 } 200 }
203 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); 201 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width());
204 mediaPlayerState.setPosition( val ); 202 mediaPlayerState.setPosition( val );
205} 203}
206 204
207void VideoWidget::setPosition( long i ) { 205void VideoWidget::setPosition( long i ) {
208 updateSlider( i, mediaPlayerState.length() ); 206 updateSlider( i, mediaPlayerState.length() );
209} 207}
210 208
211 209
212void VideoWidget::setLength( long max ) { 210void VideoWidget::setLength( long max ) {
213 updateSlider( mediaPlayerState.position(), max ); 211 updateSlider( mediaPlayerState.position(), max );
214} 212}
215 213
216void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) 214void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType )
217{ 215{
218 if ( displayType == MediaPlayerState::Video ) { 216 if ( displayType == MediaPlayerState::Video ) {
219 makeVisible(); 217 makeVisible();
220 return; 218 return;
221 } 219 }
222 220
223 // Effectively blank the view next time we show it so it looks nicer 221 // Effectively blank the view next time we show it so it looks nicer
224 scaledWidth = 0; 222 scaledWidth = 0;
225 scaledHeight = 0; 223 scaledHeight = 0;
226 hide(); 224 hide();
227} 225}
228 226
229void VideoWidget::updateSlider( long i, long max ) { 227void VideoWidget::updateSlider( long i, long max ) {
230 // Will flicker too much if we don't do this 228 // Will flicker too much if we don't do this
231 if ( max == 0 ) { 229 if ( max == 0 ) {
232 return; 230 return;
233 } 231 }
234 int width = slider->width(); 232 int width = slider->width();
235 int val = int((double)i * width / max); 233 int val = int((double)i * width / max);
236 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { 234 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) {
237 if ( slider->value() != val ) { 235 if ( slider->value() != val ) {
238 slider->setValue( val ); 236 slider->setValue( val );
239 } 237 }
240 if ( slider->maxValue() != width ) { 238 if ( slider->maxValue() != width ) {
241 slider->setMaxValue( width ); 239 slider->setMaxValue( width );
242 } 240 }
243 } 241 }
244} 242}
245 243
246void VideoWidget::mousePressEvent( QMouseEvent *event ) { 244void VideoWidget::mousePressEvent( QMouseEvent *event ) {
247 mouseMoveEvent( event ); 245 mouseMoveEvent( event );
248} 246}
249 247
250void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 248void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
251 if ( mediaPlayerState.isFullscreen() ) { 249 if ( mediaPlayerState.isFullscreen() ) {
252 mediaPlayerState.setFullscreen( FALSE ); 250 mediaPlayerState.setFullscreen( FALSE );
253 makeVisible(); 251 makeVisible();
254 } 252 }
255 mouseMoveEvent( event ); 253 mouseMoveEvent( event );
256} 254}
257 255
258void VideoWidget::showEvent( QShowEvent* ) { 256void VideoWidget::showEvent( QShowEvent* ) {
259 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 257 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
260 mouseMoveEvent( &event ); 258 mouseMoveEvent( &event );
261} 259}
262 260
263 261
264 void VideoWidget::backToNormal() { 262 void VideoWidget::backToNormal() {
265 mediaPlayerState.setFullscreen( FALSE ); 263 mediaPlayerState.setFullscreen( FALSE );
266 makeVisible(); 264 makeVisible();
267 } 265 }
268 266
269void VideoWidget::makeVisible() { 267void VideoWidget::makeVisible() {
270 if ( mediaPlayerState.isFullscreen() ) { 268 if ( mediaPlayerState.isFullscreen() ) {
271 setBackgroundMode( QWidget::NoBackground ); 269 setBackgroundMode( QWidget::NoBackground );
272 showFullScreen(); 270 showFullScreen();
273 resize( qApp->desktop()->size() ); 271 resize( qApp->desktop()->size() );
274 videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); 272 videoFrame-> setGeometry ( 0, 0, width ( ), height ( ));
275 273
276 slider->hide(); 274 slider->hide();
277 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 275 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
278 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 276 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
279 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 277 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
280 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 278 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
281 279
282 } else { 280 } else {
283 showNormal(); 281 showNormal();
284 showMaximized(); 282 showMaximized();
285 setBackgroundPixmap( backgroundPixmap ); 283 setBackgroundPixmap( backgroundPixmap );
286 QWidget *d = QApplication::desktop(); 284 QWidget *d = QApplication::desktop();
287 int w = d->width(); 285 int w = d->width();
288 int h = d->height(); 286 int h = d->height();
289 287
290 if(w>h) { 288 if(w>h) {
291 int newW=(w/2)-(246/2); //this will only work with 320x240 289 int newW=(w/2)-(246/2); //this will only work with 320x240
292 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); 290 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) );
293 } else { 291 } else {
294 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); 292 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) );
295 } 293 }
296 294
297 if ( !mediaPlayerState.isSeekable() ) { 295 if ( !mediaPlayerState.isSeekable() ) {
298 if( !slider->isHidden()) { 296 if( !slider->isHidden()) {
299 slider->hide(); 297 slider->hide();
300 } 298 }
301 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 299 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
302 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 300 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
303 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 301 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
304 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 302 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
305 } else { 303 } else {
306 slider->show(); 304 slider->show();
307 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 305 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
308 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 306 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
309 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 307 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
310 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 308 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
311 } 309 }
312 } 310 }
313} 311}
314 312
315void VideoWidget::keyReleaseEvent( QKeyEvent *e) { 313void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
316 switch ( e->key() ) { 314 switch ( e->key() ) {
317////////////////////////////// Zaurus keys 315////////////////////////////// Zaurus keys
318 case Key_Home: 316 case Key_Home:
319 break; 317 break;
320 case Key_F9: //activity 318 case Key_F9: //activity
321 break; 319 break;
322 case Key_F10: //contacts 320 case Key_F10: //contacts
323// hide(); 321// hide();
324 break; 322 break;
325 case Key_F11: //menu 323 case Key_F11: //menu
326 break; 324 break;
327 case Key_F12: //home 325 case Key_F12: //home
328 break; 326 break;
329 case Key_F13: //mail 327 case Key_F13: //mail
330 break; 328 break;
331 case Key_Space: { 329 case Key_Space: {
332 if(mediaPlayerState.isPlaying()) { 330 if(mediaPlayerState.isPlaying()) {
333 mediaPlayerState.setPlaying(FALSE); 331 mediaPlayerState.setPlaying(FALSE);
334 } else { 332 } else {
335 mediaPlayerState.setPlaying(TRUE); 333 mediaPlayerState.setPlaying(TRUE);
336 } 334 }
337 } 335 }
338 break; 336 break;
339 case Key_Down: 337 case Key_Down:
340// toggleButton(6); 338// toggleButton(6);
341 emit lessClicked(); 339 emit lessClicked();
342 emit lessReleased(); 340 emit lessReleased();
343// toggleButton(6); 341// toggleButton(6);
344 break; 342 break;
345 case Key_Up: 343 case Key_Up:
346// toggleButton(5); 344// toggleButton(5);
347 emit moreClicked(); 345 emit moreClicked();
348 emit moreReleased(); 346 emit moreReleased();
349// toggleButton(5); 347// toggleButton(5);
350 break; 348 break;
351 case Key_Right: 349 case Key_Right:
352 mediaPlayerState.setNext(); 350 mediaPlayerState.setNext();
353 break; 351 break;
354 case Key_Left: 352 case Key_Left:
355 mediaPlayerState.setPrev(); 353 mediaPlayerState.setPrev();
356 break; 354 break;
357 case Key_Escape: 355 case Key_Escape:
358 break; 356 break;
359 357
360 }; 358 };
361} 359}
362 360
363XineVideoWidget* VideoWidget::vidWidget() { 361XineVideoWidget* VideoWidget::vidWidget() {
364 return videoFrame; 362 return videoFrame;
365} 363}
366 364
367 365
368void VideoWidget::setFullscreen ( bool b ) { 366void VideoWidget::setFullscreen ( bool b ) {
369 setToggleButton( FullScreen, b ); 367 setToggleButton( FullScreen, b );
370} 368}
371 369
372 370
373void VideoWidget::setPlaying( bool b) { 371void VideoWidget::setPlaying( bool b) {
374 setToggleButton( Play, b ); 372 setToggleButton( Play, b );
375} 373}
376 374
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index 7d50ea0..bed2116 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -1,102 +1,104 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
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#ifndef VIDEO_WIDGET_H 34#ifndef VIDEO_WIDGET_H
35#define VIDEO_WIDGET_H 35#define VIDEO_WIDGET_H
36 36
37#include <qwidget.h> 37#include <qwidget.h>
38#include <qimage.h> 38#include <qimage.h>
39#include <qpixmap.h> 39#include <qpixmap.h>
40#include "xinevideowidget.h" 40#include "xinevideowidget.h"
41 41
42#include "mediawidget.h" 42#include "mediawidget.h"
43 43
44class QPixmap; 44class QPixmap;
45class QSlider; 45class QSlider;
46 46
47class VideoWidget : public MediaWidget { 47class VideoWidget : public MediaWidget {
48 Q_OBJECT 48 Q_OBJECT
49public: 49public:
50 VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); 50 VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
51 ~VideoWidget(); 51 ~VideoWidget();
52 52
53 53
54 XineVideoWidget* vidWidget(); 54 XineVideoWidget* vidWidget();
55public slots: 55public slots:
56 void updateSlider( long, long ); 56 void updateSlider( long, long );
57 void sliderPressed( ); 57 void sliderPressed( );
58 void sliderReleased( ); 58 void sliderReleased( );
59 void setFullscreen( bool b ); 59 void setFullscreen( bool b );
60 virtual void makeVisible(); 60 virtual void makeVisible();
61 void backToNormal(); 61 void backToNormal();
62 void setPosition( long ); 62 void setPosition( long );
63 63
64public: 64public:
65 virtual void setPlaying( bool b); 65 virtual void setPlaying( bool b);
66 virtual void setLength( long ); 66 virtual void setLength( long );
67 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 67 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
68 68
69signals: 69signals:
70 void moreClicked(); 70 void moreClicked();
71 void lessClicked(); 71 void lessClicked();
72 void sliderMoved( long ); 72 void sliderMoved( long );
73 void videoResized ( const QSize &s ); 73 void videoResized ( const QSize &s );
74 74
75protected: 75protected:
76 76
77 void resizeEvent( QResizeEvent * ); 77 void resizeEvent( QResizeEvent * );
78 void showEvent( QShowEvent *se ); 78 void showEvent( QShowEvent *se );
79 void mousePressEvent( QMouseEvent *event ); 79 void mousePressEvent( QMouseEvent *event );
80 void mouseReleaseEvent( QMouseEvent *event ); 80 void mouseReleaseEvent( QMouseEvent *event );
81 void keyReleaseEvent( QKeyEvent *e); 81 void keyReleaseEvent( QKeyEvent *e);
82 82
83private: 83private:
84// Ticker songInfo; 84// Ticker songInfo;
85 QImage imgUp; 85 QImage imgUp;
86 QImage imgDn; 86 QImage imgDn;
87 QString skin; 87 QString skin;
88 88
89 89
90 90
91 QString backgroundPix; 91 QString backgroundPix;
92 QSlider *slider; 92 QSlider *slider;
93 QImage *currentFrame; 93 QImage *currentFrame;
94 int scaledWidth; 94 int scaledWidth;
95 int scaledHeight; 95 int scaledHeight;
96 XineVideoWidget* videoFrame; 96 XineVideoWidget* videoFrame;
97
98 bool videoSliderBeingMoved;
97}; 99};
98 100
99#endif // VIDEO_WIDGET_H 101#endif // VIDEO_WIDGET_H
100 102
101 103
102 104