summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-04-20 21:39:03 (UTC)
committer harlekin <harlekin>2002-04-20 21:39:03 (UTC)
commite657b8203c7b649fd3df96afbe7f8b1d24b5b8ed (patch) (unidiff)
tree327c776a79f6444f38dc1bbddf1e530dabce8972
parent22dc731f503383e95c49d88ca4e9c32c7ed4fb3a (diff)
downloadopie-e657b8203c7b649fd3df96afbe7f8b1d24b5b8ed.zip
opie-e657b8203c7b649fd3df96afbe7f8b1d24b5b8ed.tar.gz
opie-e657b8203c7b649fd3df96afbe7f8b1d24b5b8ed.tar.bz2
updated paths for icons
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp16
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp36
2 files changed, 26 insertions, 26 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp
index cda3f77..3212001 100644
--- a/core/multimedia/opieplayer/audiowidget.cpp
+++ b/core/multimedia/opieplayer/audiowidget.cpp
@@ -44,64 +44,64 @@ struct MediaButton {
44 44
45 45
46// Layout information for the audioButtons (and if it is a toggle button or not) 46// Layout information for the audioButtons (and if it is a toggle button or not)
47MediaButton audioButtons[] = { 47MediaButton audioButtons[] = {
48 { 3*30-15+xo, 3*30-13+yo, 0, TRUE, TRUE, FALSE, FALSE }, // play 48 { 3*30-15+xo, 3*30-13+yo, 0, TRUE, TRUE, FALSE, FALSE }, // play
49 { 1*30+xo, 5*30+yo, 2, FALSE, FALSE, FALSE, FALSE }, // stop 49 { 1*30+xo, 5*30+yo, 2, FALSE, FALSE, FALSE, FALSE }, // stop
50 { 5*30+xo, 5*30+yo, 2, TRUE, FALSE, FALSE, FALSE }, // pause 50 { 5*30+xo, 5*30+yo, 2, TRUE, FALSE, FALSE, FALSE }, // pause
51 { 6*30-5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // next 51 { 6*30-5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // next
52 { 0*30+5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // previous 52 { 0*30+5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // previous
53 { 3*30+xo, 0*30+5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume up 53 { 3*30+xo, 0*30+5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume up
54 { 3*30+xo, 6*30-5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume down 54 { 3*30+xo, 6*30-5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume down
55 { 5*30+xo, 1*30+yo, 0, TRUE, FALSE, FALSE, FALSE }, // repeat/loop 55 { 5*30+xo, 1*30+yo, 0, TRUE, FALSE, FALSE, FALSE }, // repeat/loop
56 { 1*30+xo, 1*30+yo, 0, FALSE, FALSE, FALSE, FALSE } // playlist 56 { 1*30+xo, 1*30+yo, 0, FALSE, FALSE, FALSE, FALSE } // playlist
57}; 57};
58 58
59 59
60static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); 60static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
61 61
62 62
63AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : 63AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
64 QWidget( parent, name, f ) 64 QWidget( parent, name, f )
65{ 65{
66// QPEApplication::grabKeyboard(); 66// QPEApplication::grabKeyboard();
67 setCaption( tr("OpiePlayer") ); 67 setCaption( tr("OpiePlayer") );
68 setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); 68 setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) );
69 pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsAll" ) ); 69 pixmaps[0] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButtonsAll" ) );
70 pixmaps[1] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsBig" ) ); 70 pixmaps[1] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButtonsBig" ) );
71 pixmaps[2] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaControls" ) ); 71 pixmaps[2] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaControls" ) );
72 pixmaps[3] = new QPixmap( Resource::loadPixmap( "mpegplayer/animatedButton" ) ); 72 pixmaps[3] = new QPixmap( Resource::loadPixmap( "opieplayer/animatedButton" ) );
73 73
74 songInfo = new Ticker( this ); 74 songInfo = new Ticker( this );
75 songInfo->setFocusPolicy( QWidget::NoFocus ); 75 songInfo->setFocusPolicy( QWidget::NoFocus );
76 songInfo->setGeometry( QRect( 7, 3, 220, 20 ) ); 76 songInfo->setGeometry( QRect( 7, 3, 220, 20 ) );
77 77
78 slider = new QSlider( Qt::Horizontal, this ); 78 slider = new QSlider( Qt::Horizontal, this );
79 slider->setFixedWidth( 220 ); 79 slider->setFixedWidth( 220 );
80 slider->setFixedHeight( 20 ); 80 slider->setFixedHeight( 20 );
81 slider->setMinValue( 0 ); 81 slider->setMinValue( 0 );
82 slider->setMaxValue( 1 ); 82 slider->setMaxValue( 1 );
83 slider->setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); 83 slider->setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) );
84 slider->setFocusPolicy( QWidget::NoFocus ); 84 slider->setFocusPolicy( QWidget::NoFocus );
85 slider->setGeometry( QRect( 7, 262, 220, 20 ) ); 85 slider->setGeometry( QRect( 7, 262, 220, 20 ) );
86 86
87 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 87 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
88 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 88 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
89 89
90 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 90 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
91 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 91 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
92 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 92 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
93 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 93 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
94 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 94 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
95 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); 95 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
96 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 96 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
97 97
98 // Intialise state 98 // Intialise state
99 setLength( mediaPlayerState->length() ); 99 setLength( mediaPlayerState->length() );
100 setPosition( mediaPlayerState->position() ); 100 setPosition( mediaPlayerState->position() );
101 setLooping( mediaPlayerState->fullscreen() ); 101 setLooping( mediaPlayerState->fullscreen() );
102 setPaused( mediaPlayerState->paused() ); 102 setPaused( mediaPlayerState->paused() );
103 setPlaying( mediaPlayerState->playing() ); 103 setPlaying( mediaPlayerState->playing() );
104 104
105} 105}
106 106
107 107
@@ -132,49 +132,49 @@ void AudioWidget::setPosition( long i ) {
132 updateSlider( i, mediaPlayerState->length() ); 132 updateSlider( i, mediaPlayerState->length() );
133} 133}
134 134
135 135
136void AudioWidget::setLength( long max ) { 136void AudioWidget::setLength( long max ) {
137 updateSlider( mediaPlayerState->position(), max ); 137 updateSlider( mediaPlayerState->position(), max );
138} 138}
139 139
140 140
141void AudioWidget::setView( char view ) { 141void AudioWidget::setView( char view ) {
142 if ( view == 'a' ) { 142 if ( view == 'a' ) {
143 startTimer( 150 ); 143 startTimer( 150 );
144 showMaximized(); 144 showMaximized();
145 } else { 145 } else {
146 killTimers(); 146 killTimers();
147 hide(); 147 hide();
148 } 148 }
149} 149}
150 150
151 151
152void AudioWidget::updateSlider( long i, long max ) { 152void AudioWidget::updateSlider( long i, long max ) {
153 if ( max == 0 ) 153 if ( max == 0 )
154 return; 154 return;
155 // Will flicker too much if we don't do this 155 // Will flicker too much if we don't do this
156 // Scale to something reasonable 156 // Scale to something reasonable
157 int width = slider->width(); 157 int width = slider->width();
158 int val = int((double)i * width / max); 158 int val = int((double)i * width / max);
159 if ( !audioSliderBeingMoved ) { 159 if ( !audioSliderBeingMoved ) {
160 if ( slider->value() != val ) 160 if ( slider->value() != val )
161 slider->setValue( val ); 161 slider->setValue( val );
162 if ( slider->maxValue() != width ) 162 if ( slider->maxValue() != width )
163 slider->setMaxValue( width ); 163 slider->setMaxValue( width );
164 } 164 }
165} 165}
166 166
167 167
168void AudioWidget::setToggleButton( int i, bool down ) { 168void AudioWidget::setToggleButton( int i, bool down ) {
169 if ( down != audioButtons[i].isDown ) 169 if ( down != audioButtons[i].isDown )
170 toggleButton( i ); 170 toggleButton( i );
171} 171}
172 172
173 173
174void AudioWidget::toggleButton( int i ) { 174void AudioWidget::toggleButton( int i ) {
175 audioButtons[i].isDown = !audioButtons[i].isDown; 175 audioButtons[i].isDown = !audioButtons[i].isDown;
176 QPainter p(this); 176 QPainter p(this);
177 paintButton ( &p, i ); 177 paintButton ( &p, i );
178} 178}
179 179
180 180
@@ -312,27 +312,27 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e)
312 case Key_Down: 312 case Key_Down:
313 toggleButton(6); 313 toggleButton(6);
314 emit lessClicked(); 314 emit lessClicked();
315 emit lessReleased(); 315 emit lessReleased();
316 toggleButton(6); 316 toggleButton(6);
317 break; 317 break;
318 case Key_Up: 318 case Key_Up:
319 toggleButton(5); 319 toggleButton(5);
320 emit moreClicked(); 320 emit moreClicked();
321 emit moreReleased(); 321 emit moreReleased();
322 toggleButton(5); 322 toggleButton(5);
323 break; 323 break;
324 case Key_Right: 324 case Key_Right:
325// toggleButton(3); 325// toggleButton(3);
326 mediaPlayerState->setNext(); 326 mediaPlayerState->setNext();
327// toggleButton(3); 327// toggleButton(3);
328 break; 328 break;
329 case Key_Left: 329 case Key_Left:
330// toggleButton(4); 330// toggleButton(4);
331 mediaPlayerState->setPrev(); 331 mediaPlayerState->setPrev();
332// toggleButton(4); 332// toggleButton(4);
333 break; 333 break;
334 case Key_Escape: 334 case Key_Escape:
335 break; 335 break;
336 336
337 }; 337 };
338} 338}
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp
index 23b36e5..70b4a95 100644
--- a/core/multimedia/opieplayer/videowidget.cpp
+++ b/core/multimedia/opieplayer/videowidget.cpp
@@ -46,58 +46,58 @@ struct MediaButton {
46 int xPos, yPos; 46 int xPos, yPos;
47 bool isToggle, isHeld, isDown; 47 bool isToggle, isHeld, isDown;
48 int controlType; 48 int controlType;
49}; 49};
50 50
51 51
52// Layout information for the videoButtons (and if it is a toggle button or not) 52// Layout information for the videoButtons (and if it is a toggle button or not)
53MediaButton videoButtons[] = { 53MediaButton videoButtons[] = {
54 { 5+0*32+xo, 200+yo, FALSE, FALSE, FALSE, 4 }, // previous 54 { 5+0*32+xo, 200+yo, FALSE, FALSE, FALSE, 4 }, // previous
55 { 5+1*32+xo, 200+yo, FALSE, FALSE, FALSE, 1 }, // stop 55 { 5+1*32+xo, 200+yo, FALSE, FALSE, FALSE, 1 }, // stop
56 { 5+2*32+xo, 200+yo, TRUE, FALSE, FALSE, 0 }, // play 56 { 5+2*32+xo, 200+yo, TRUE, FALSE, FALSE, 0 }, // play
57 { 5+3*32+xo, 200+yo, TRUE, FALSE, FALSE, 2 }, // pause 57 { 5+3*32+xo, 200+yo, TRUE, FALSE, FALSE, 2 }, // pause
58 { 5+4*32+xo, 200+yo, FALSE, FALSE, FALSE, 3 }, // next 58 { 5+4*32+xo, 200+yo, FALSE, FALSE, FALSE, 3 }, // next
59 { 5+5*32+xo, 200+yo, FALSE, FALSE, FALSE, 8 }, // playlist 59 { 5+5*32+xo, 200+yo, FALSE, FALSE, FALSE, 8 }, // playlist
60 { 5+6*32+xo, 200+yo, TRUE, FALSE, FALSE, 9 } // fullscreen 60 { 5+6*32+xo, 200+yo, TRUE, FALSE, FALSE, 9 } // fullscreen
61}; 61};
62 62
63 63
64static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 64static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton));
65 65
66 66
67VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : 67VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
68 QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { 68 QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) {
69 setCaption( tr("OpiePlayer") ); 69 setCaption( tr("OpiePlayer") );
70 setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); 70 setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) );
71 pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButton0a" ) ); 71 pixmaps[0] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButton0a" ) );
72 pixmaps[1] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButton0b" ) ); 72 pixmaps[1] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButton0b" ) );
73 pixmaps[2] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaControls0" ) ); 73 pixmaps[2] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaControls0" ) );
74 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); 74 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 );
75 75
76 slider = new QSlider( Qt::Horizontal, this ); 76 slider = new QSlider( Qt::Horizontal, this );
77 slider->setMinValue( 0 ); 77 slider->setMinValue( 0 );
78 slider->setMaxValue( 1 ); 78 slider->setMaxValue( 1 );
79 slider->setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); 79 slider->setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) );
80 slider->setFocusPolicy( QWidget::NoFocus ); 80 slider->setFocusPolicy( QWidget::NoFocus );
81 slider->setGeometry( QRect( 7, 250, 220, 20 ) ); 81 slider->setGeometry( QRect( 7, 250, 220, 20 ) );
82 82
83 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 83 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
84 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 84 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
85 85
86 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 86 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
87 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 87 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
88 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 88 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
89 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 89 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
90 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); 90 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
91 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 91 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
92 92
93 // Intialise state 93 // Intialise state
94 setLength( mediaPlayerState->length() ); 94 setLength( mediaPlayerState->length() );
95 setPosition( mediaPlayerState->position() ); 95 setPosition( mediaPlayerState->position() );
96 setFullscreen( mediaPlayerState->fullscreen() ); 96 setFullscreen( mediaPlayerState->fullscreen() );
97 setPaused( mediaPlayerState->paused() ); 97 setPaused( mediaPlayerState->paused() );
98 setPlaying( mediaPlayerState->playing() ); 98 setPlaying( mediaPlayerState->playing() );
99} 99}
100 100
101 101
102VideoWidget::~VideoWidget() { 102VideoWidget::~VideoWidget() {
103 for ( int i = 0; i < 3; i++ ) 103 for ( int i = 0; i < 3; i++ )
@@ -180,242 +180,242 @@ void VideoWidget::paintButton( QPainter *p, int i ) {
180 p->drawPixmap( x, y, *pixmaps[videoButtons[i].isDown] ); 180 p->drawPixmap( x, y, *pixmaps[videoButtons[i].isDown] );
181 p->drawPixmap( x + 1 + offset, y + offset, *pixmaps[2], 9 * videoButtons[i].controlType, 0, 9, 9 ); 181 p->drawPixmap( x + 1 + offset, y + offset, *pixmaps[2], 9 * videoButtons[i].controlType, 0, 9, 9 );
182} 182}
183 183
184 184
185void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 185void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
186 for ( int i = 0; i < numButtons; i++ ) { 186 for ( int i = 0; i < numButtons; i++ ) {
187 int x = videoButtons[i].xPos; 187 int x = videoButtons[i].xPos;
188 int y = videoButtons[i].yPos; 188 int y = videoButtons[i].yPos;
189 if ( event->state() == QMouseEvent::LeftButton ) { 189 if ( event->state() == QMouseEvent::LeftButton ) {
190 // The test to see if the mouse click is inside the circular button or not 190 // The test to see if the mouse click is inside the circular button or not
191 // (compared with the radius squared to avoid a square-root of our distance) 191 // (compared with the radius squared to avoid a square-root of our distance)
192 int radius = 16; 192 int radius = 16;
193 QPoint center = QPoint( x + radius, y + radius ); 193 QPoint center = QPoint( x + radius, y + radius );
194 QPoint dXY = center - event->pos(); 194 QPoint dXY = center - event->pos();
195 int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); 195 int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y();
196 bool isOnButton = dist <= (radius * radius); 196 bool isOnButton = dist <= (radius * radius);
197 if ( isOnButton != videoButtons[i].isHeld ) { 197 if ( isOnButton != videoButtons[i].isHeld ) {
198 videoButtons[i].isHeld = isOnButton; 198 videoButtons[i].isHeld = isOnButton;
199 toggleButton(i); 199 toggleButton(i);
200 } 200 }
201 } else { 201 } else {
202 if ( videoButtons[i].isHeld ) { 202 if ( videoButtons[i].isHeld ) {
203 videoButtons[i].isHeld = FALSE; 203 videoButtons[i].isHeld = FALSE;
204 if ( !videoButtons[i].isToggle ) 204 if ( !videoButtons[i].isToggle )
205 setToggleButton( i, FALSE ); 205 setToggleButton( i, FALSE );
206 } 206 }
207 } 207 }
208 switch (i) { 208 switch (i) {
209 case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; 209 case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return;
210 case VideoStop: mediaPlayerState->setPlaying(FALSE); return; 210 case VideoStop: mediaPlayerState->setPlaying(FALSE); return;
211 case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; 211 case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return;
212 case VideoNext: mediaPlayerState->setNext(); return; 212 case VideoNext: mediaPlayerState->setNext(); return;
213 case VideoPrevious: mediaPlayerState->setPrev(); return; 213 case VideoPrevious: mediaPlayerState->setPrev(); return;
214 case VideoPlayList: mediaPlayerState->setList(); return; 214 case VideoPlayList: mediaPlayerState->setList(); return;
215 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; 215 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
216 } 216 }
217 217
218 } 218 }
219} 219}
220 220
221 221
222void VideoWidget::mousePressEvent( QMouseEvent *event ) { 222void VideoWidget::mousePressEvent( QMouseEvent *event ) {
223 mouseMoveEvent( event ); 223 mouseMoveEvent( event );
224} 224}
225 225
226 226
227void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 227void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
228 if ( mediaPlayerState->fullscreen() ) { 228 if ( mediaPlayerState->fullscreen() ) {
229 mediaPlayerState->setFullscreen( FALSE ); 229 mediaPlayerState->setFullscreen( FALSE );
230 makeVisible(); 230 makeVisible();
231 231
232 mouseMoveEvent( event ); 232 mouseMoveEvent( event );
233 } 233 }
234} 234}
235 235
236 236
237void VideoWidget::makeVisible() { 237void VideoWidget::makeVisible() {
238 if ( mediaPlayerState->fullscreen() ) { 238 if ( mediaPlayerState->fullscreen() ) {
239 setBackgroundMode( QWidget::NoBackground ); 239 setBackgroundMode( QWidget::NoBackground );
240 showFullScreen(); 240 showFullScreen();
241 resize( qApp->desktop()->size() ); 241 resize( qApp->desktop()->size() );
242 slider->hide(); 242 slider->hide();
243 } else { 243 } else {
244 setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); 244 setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) );
245 showNormal(); 245 showNormal();
246 showMaximized(); 246 showMaximized();
247 slider->show(); 247 slider->show();
248 } 248 }
249} 249}
250 250
251 251
252void VideoWidget::paintEvent( QPaintEvent * ) { 252void VideoWidget::paintEvent( QPaintEvent * ) {
253 QPainter p( this ); 253 QPainter p( this );
254 254
255 if ( mediaPlayerState->fullscreen() ) { 255 if ( mediaPlayerState->fullscreen() ) {
256 // Clear the background 256 // Clear the background
257 p.setBrush( QBrush( Qt::black ) ); 257 p.setBrush( QBrush( Qt::black ) );
258 p.drawRect( rect() ); 258 p.drawRect( rect() );
259 259
260 // Draw the current frame 260 // Draw the current frame
261 //p.drawImage( ); // If using directpainter we won't have a copy except whats on the screen 261 //p.drawImage( ); // If using directpainter we won't have a copy except whats on the screen
262 } else { 262 } else {
263 // draw border 263 // draw border
264 qDrawShadePanel( &p, 4, 15, 230, 170, colorGroup(), TRUE, 5, NULL ); 264 qDrawShadePanel( &p, 4, 15, 230, 170, colorGroup(), TRUE, 5, NULL );
265 265
266 // Clear the movie screen first 266 // Clear the movie screen first
267 p.setBrush( QBrush( Qt::black ) ); 267 p.setBrush( QBrush( Qt::black ) );
268 p.drawRect( 9, 20, 220, 160 ); 268 p.drawRect( 9, 20, 220, 160 );
269 269
270 // draw current frame (centrally positioned from scaling to maintain aspect ratio) 270 // draw current frame (centrally positioned from scaling to maintain aspect ratio)
271 p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); 271 p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight );
272 272
273 // draw the buttons 273 // draw the buttons
274 for ( int i = 0; i < numButtons; i++ ) 274 for ( int i = 0; i < numButtons; i++ )
275 paintButton( &p, i ); 275 paintButton( &p, i );
276 276
277 // draw the slider 277 // draw the slider
278 slider->repaint( TRUE ); 278 slider->repaint( TRUE );
279 } 279 }
280} 280}
281 281
282 282
283void VideoWidget::closeEvent( QCloseEvent* ) { 283void VideoWidget::closeEvent( QCloseEvent* ) {
284 mediaPlayerState->setList(); 284 mediaPlayerState->setList();
285} 285}
286 286
287 287
288bool VideoWidget::playVideo() { 288bool VideoWidget::playVideo() {
289 bool result = FALSE; 289 bool result = FALSE;
290 290
291 int stream = 0; 291 int stream = 0;
292 292
293 int sw = mediaPlayerState->curDecoder()->videoWidth( stream ); 293 int sw = mediaPlayerState->curDecoder()->videoWidth( stream );
294 int sh = mediaPlayerState->curDecoder()->videoHeight( stream ); 294 int sh = mediaPlayerState->curDecoder()->videoHeight( stream );
295 int dd = QPixmap::defaultDepth(); 295 int dd = QPixmap::defaultDepth();
296 int w = height(); 296 int w = height();
297 int h = width(); 297 int h = width();
298 298
299 ColorFormat format = (dd == 16) ? RGB565 : BGRA8888; 299 ColorFormat format = (dd == 16) ? RGB565 : BGRA8888;
300 300
301 if ( mediaPlayerState->fullscreen() ) { 301 if ( mediaPlayerState->fullscreen() ) {
302#ifdef USE_DIRECT_PAINTER 302#ifdef USE_DIRECT_PAINTER
303 QDirectPainter p(this); 303 QDirectPainter p(this);
304 304
305 if ( ( qt_screen->transformOrientation() == 3 ) && 305 if ( ( qt_screen->transformOrientation() == 3 ) &&
306 ( ( dd == 16 ) || ( dd == 32 ) ) && ( p.numRects() == 1 ) ) { 306 ( ( dd == 16 ) || ( dd == 32 ) ) && ( p.numRects() == 1 ) ) {
307 307
308 w = 320; 308 w = 320;
309 h = 240; 309 h = 240;
310 310
311 if ( mediaPlayerState->scaled() ) { 311 if ( mediaPlayerState->scaled() ) {
312 // maintain aspect ratio 312 // maintain aspect ratio
313 if ( w * sh > sw * h ) 313 if ( w * sh > sw * h )
314 w = sw * h / sh; 314 w = sw * h / sh;
315 else 315 else
316 h = sh * w / sw; 316 h = sh * w / sw;
317 } else { 317 } else {
318 w = sw; 318 w = sw;
319 h = sh; 319 h = sh;
320 } 320 }
321 321
322 w--; // we can't allow libmpeg to overwrite. 322 w--; // we can't allow libmpeg to overwrite.
323 QPoint roff = qt_screen->mapToDevice( p.offset(), QSize( qt_screen->width(), qt_screen->height() ) ); 323 QPoint roff = qt_screen->mapToDevice( p.offset(), QSize( qt_screen->width(), qt_screen->height() ) );
324 324
325 int ox = roff.x() - height() + 2 + (height() - w) / 2; 325 int ox = roff.x() - height() + 2 + (height() - w) / 2;
326 int oy = roff.y() + (width() - h) / 2; 326 int oy = roff.y() + (width() - h) / 2;
327 int sx = 0, sy = 0; 327 int sx = 0, sy = 0;
328 328
329 uchar* fp = p.frameBuffer() + p.lineStep() * oy; 329 uchar* fp = p.frameBuffer() + p.lineStep() * oy;
330 fp += dd * ox / 8; 330 fp += dd * ox / 8;
331 uchar **jt = new uchar*[h]; 331 uchar **jt = new uchar*[h];
332 for ( int i = h; i; i-- ) { 332 for ( int i = h; i; i-- ) {
333 jt[h - i] = fp; 333 jt[h - i] = fp;
334 fp += p.lineStep(); 334 fp += p.lineStep();
335 } 335 }
336 336
337 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( jt, sx, sy, sw, sh, w, h, format, 0) == 0; 337 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( jt, sx, sy, sw, sh, w, h, format, 0) == 0;
338 338
339 delete [] jt; 339 delete [] jt;
340 } else { 340 } else {
341#endif 341#endif
342 QPainter p(this); 342 QPainter p(this);
343 343
344 w = 320; 344 w = 320;
345 h = 240; 345 h = 240;
346 346
347 if ( mediaPlayerState->scaled() ) { 347 if ( mediaPlayerState->scaled() ) {
348 // maintain aspect ratio 348 // maintain aspect ratio
349 if ( w * sh > sw * h ) 349 if ( w * sh > sw * h )
350 w = sw * h / sh; 350 w = sw * h / sh;
351 else 351 else
352 h = sh * w / sw; 352 h = sh * w / sw;
353 } else { 353 } else {
354 w = sw; 354 w = sw;
355 h = sh; 355 h = sh;
356 } 356 }
357 357
358 int bytes = ( dd == 16 ) ? 2 : 4; 358 int bytes = ( dd == 16 ) ? 2 : 4;
359 QImage tempFrame( w, h, bytes << 3 ); 359 QImage tempFrame( w, h, bytes << 3 );
360 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( tempFrame.jumpTable(), 360 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( tempFrame.jumpTable(),
361 0, 0, sw, sh, w, h, format, 0) == 0; 361 0, 0, sw, sh, w, h, format, 0) == 0;
362 if ( result && mediaPlayerState->fullscreen() ) { 362 if ( result && mediaPlayerState->fullscreen() ) {
363 363
364 int rw = h, rh = w; 364 int rw = h, rh = w;
365 QImage rotatedFrame( rw, rh, bytes << 3 ); 365 QImage rotatedFrame( rw, rh, bytes << 3 );
366 366
367 ushort* in = (ushort*)tempFrame.bits(); 367 ushort* in = (ushort*)tempFrame.bits();
368 ushort* out = (ushort*)rotatedFrame.bits(); 368 ushort* out = (ushort*)rotatedFrame.bits();
369 int spl = rotatedFrame.bytesPerLine() / bytes; 369 int spl = rotatedFrame.bytesPerLine() / bytes;
370 for (int x=0; x<h; x++) { 370 for (int x=0; x<h; x++) {
371 if ( bytes == 2 ) { 371 if ( bytes == 2 ) {
372 ushort* lout = out++ + (w - 1)*spl; 372 ushort* lout = out++ + (w - 1)*spl;
373 for (int y=0; y<w; y++) { 373 for (int y=0; y<w; y++) {
374 *lout=*in++; 374 *lout=*in++;
375 lout-=spl; 375 lout-=spl;
376 } 376 }
377 } else { 377 } else {
378 ulong* lout = ((ulong *)out)++ + (w - 1)*spl; 378 ulong* lout = ((ulong *)out)++ + (w - 1)*spl;
379 for (int y=0; y<w; y++) { 379 for (int y=0; y<w; y++) {
380 *lout=*((ulong*)in)++; 380 *lout=*((ulong*)in)++;
381 lout-=spl; 381 lout-=spl;
382 } 382 }
383 } 383 }
384 } 384 }
385 385
386 p.drawImage( (240 - rw) / 2, (320 - rh) / 2, rotatedFrame, 0, 0, rw, rh ); 386 p.drawImage( (240 - rw) / 2, (320 - rh) / 2, rotatedFrame, 0, 0, rw, rh );
387 } 387 }
388#ifdef USE_DIRECT_PAINTER 388#ifdef USE_DIRECT_PAINTER
389 } 389 }
390#endif 390#endif
391 } else { 391 } else {
392 392
393 w = 220; 393 w = 220;
394 h = 160; 394 h = 160;
395 395
396 // maintain aspect ratio 396 // maintain aspect ratio
397 if ( w * sh > sw * h ) 397 if ( w * sh > sw * h )
398 w = sw * h / sh; 398 w = sw * h / sh;
399 else 399 else
400 h = sh * w / sw; 400 h = sh * w / sw;
401 401
402 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( currentFrame->jumpTable(), 0, 0, sw, sh, w, h, format, 0) == 0; 402 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( currentFrame->jumpTable(), 0, 0, sw, sh, w, h, format, 0) == 0;
403 403
404 QPainter p( this ); 404 QPainter p( this );
405 405
406 // Image changed size, therefore need to blank the possibly unpainted regions first 406 // Image changed size, therefore need to blank the possibly unpainted regions first
407 if ( scaledWidth != w || scaledHeight != h ) { 407 if ( scaledWidth != w || scaledHeight != h ) {
408 p.setBrush( QBrush( Qt::black ) ); 408 p.setBrush( QBrush( Qt::black ) );
409 p.drawRect( 9, 20, 220, 160 ); 409 p.drawRect( 9, 20, 220, 160 );
410 } 410 }
411 411
412 scaledWidth = w; 412 scaledWidth = w;
413 scaledHeight = h; 413 scaledHeight = h;
414 414
415 if ( result ) { 415 if ( result ) {
416 p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); 416 p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight );
417 } 417 }
418 418
419 } 419 }
420 420
421 return result; 421 return result;
@@ -446,27 +446,27 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e)
446 mediaPlayerState->setPlaying(TRUE); 446 mediaPlayerState->setPlaying(TRUE);
447 } 447 }
448 } 448 }
449 break; 449 break;
450 case Key_Down: 450 case Key_Down:
451// toggleButton(6); 451// toggleButton(6);
452// emit lessClicked(); 452// emit lessClicked();
453// emit lessReleased(); 453// emit lessReleased();
454// toggleButton(6); 454// toggleButton(6);
455 break; 455 break;
456 case Key_Up: 456 case Key_Up:
457// toggleButton(5); 457// toggleButton(5);
458// emit moreClicked(); 458// emit moreClicked();
459// emit moreReleased(); 459// emit moreReleased();
460// toggleButton(5); 460// toggleButton(5);
461 break; 461 break;
462 case Key_Right: 462 case Key_Right:
463 mediaPlayerState->setNext(); 463 mediaPlayerState->setNext();
464 break; 464 break;
465 case Key_Left: 465 case Key_Left:
466 mediaPlayerState->setPrev(); 466 mediaPlayerState->setPrev();
467 break; 467 break;
468 case Key_Escape: 468 case Key_Escape:
469 break; 469 break;
470 470
471 }; 471 };
472} 472}