summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-11 17:16:17 (UTC)
committer simon <simon>2002-12-11 17:16:17 (UTC)
commit94461696cfdcf8cdbaabec1400300e546edc447e (patch) (unidiff)
treebacef808031edb254214d04489d4a8e4df53cdb9
parent9f5e007f4859027eaeb989c620ec62fc698b44cc (diff)
downloadopie-94461696cfdcf8cdbaabec1400300e546edc447e.zip
opie-94461696cfdcf8cdbaabec1400300e546edc447e.tar.gz
opie-94461696cfdcf8cdbaabec1400300e546edc447e.tar.bz2
- expose information about the buttons
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h4
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h2
4 files changed, 28 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 78079dd..4db444a 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -1,335 +1,345 @@
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#include <opie/oticker.h> 37#include <opie/oticker.h>
38 38
39#include <qwidget.h> 39#include <qwidget.h>
40#include <qpixmap.h> 40#include <qpixmap.h>
41#include <qbutton.h> 41#include <qbutton.h>
42#include <qpainter.h> 42#include <qpainter.h>
43#include <qframe.h> 43#include <qframe.h>
44#include <qlayout.h> 44#include <qlayout.h>
45#include <qdir.h> 45#include <qdir.h>
46#include <stdlib.h> 46#include <stdlib.h>
47#include <stdio.h> 47#include <stdio.h>
48 48
49#include "audiowidget.h" 49#include "audiowidget.h"
50#include "mediaplayerstate.h" 50#include "mediaplayerstate.h"
51#include "playlistwidget.h" 51#include "playlistwidget.h"
52 52
53namespace 53namespace
54{ 54{
55 55
56const int xo = -2; // movable x offset 56const int xo = -2; // movable x offset
57const int yo = 22; // movable y offset 57const int yo = 22; // movable y offset
58 58
59const MediaWidget::SkinButtonInfo skinInfo[] = 59const MediaWidget::SkinButtonInfo skinInfo[] =
60{ 60{
61 { MediaWidget::Play, "play", MediaWidget::ToggleButton }, 61 { MediaWidget::Play, "play", MediaWidget::ToggleButton },
62 { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, 62 { MediaWidget::Stop, "stop", MediaWidget::NormalButton },
63 { MediaWidget::Next, "next", MediaWidget::NormalButton }, 63 { MediaWidget::Next, "next", MediaWidget::NormalButton },
64 { MediaWidget::Previous, "prev", MediaWidget::NormalButton }, 64 { MediaWidget::Previous, "prev", MediaWidget::NormalButton },
65 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, 65 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton },
66 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, 66 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton },
67 { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, 67 { MediaWidget::Loop, "loop", MediaWidget::ToggleButton },
68 { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, 68 { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton },
69 { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, 69 { MediaWidget::Forward, "forward", MediaWidget::NormalButton },
70 { MediaWidget::Back, "back", MediaWidget::NormalButton } 70 { MediaWidget::Back, "back", MediaWidget::NormalButton }
71}; 71};
72 72
73const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); 73const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] );
74 74
75void changeTextColor( QWidget * w) { 75void changeTextColor( QWidget * w) {
76 QPalette p = w->palette(); 76 QPalette p = w->palette();
77 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); 77 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
78 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); 78 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
79 w->setPalette( p ); 79 w->setPalette( p );
80} 80}
81 81
82} 82}
83 83
84AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : 84AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) :
85 85
86 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), 86 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ),
87 audioSliderBeingMoved( false ) 87 audioSliderBeingMoved( false )
88{ 88{
89 setCaption( tr("OpiePlayer") ); 89 setCaption( tr("OpiePlayer") );
90 90
91 loadSkin(); 91 loadSkin();
92 92
93 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 93 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
94 connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); 94 connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) );
95 95
96 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); 96 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) );
97 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); 97 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) );
98 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); 98 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) );
99 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); 99 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) );
100 100
101 // Intialise state 101 // Intialise state
102 setLength( mediaPlayerState.length() ); 102 setLength( mediaPlayerState.length() );
103 setPosition( mediaPlayerState.position() ); 103 setPosition( mediaPlayerState.position() );
104 setLooping( mediaPlayerState.isFullscreen() ); 104 setLooping( mediaPlayerState.isFullscreen() );
105 // setPaused( mediaPlayerState->paused() ); 105 // setPaused( mediaPlayerState->paused() );
106 setPlaying( mediaPlayerState.isPlaying() ); 106 setPlaying( mediaPlayerState.isPlaying() );
107} 107}
108 108
109AudioWidget::~AudioWidget() { 109AudioWidget::~AudioWidget() {
110 110
111// mediaPlayerState->setPlaying(false); 111// mediaPlayerState->setPlaying(false);
112} 112}
113 113
114const MediaWidget::SkinButtonInfo *AudioWidget::skinInfo()
115{
116 return ::skinInfo;
117}
118
119const uint AudioWidget::buttonCount()
120{
121 return ::buttonCount;
122}
123
114void AudioWidget::resizeEvent( QResizeEvent *e ) { 124void AudioWidget::resizeEvent( QResizeEvent *e ) {
115 int h = height(); 125 int h = height();
116 int w = width(); 126 int w = width();
117 127
118 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); 128 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) );
119 slider.setFixedWidth( w - 110 ); 129 slider.setFixedWidth( w - 110 );
120 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 130 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
121 slider.setBackgroundOrigin( QWidget::ParentOrigin ); 131 slider.setBackgroundOrigin( QWidget::ParentOrigin );
122 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); 132 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
123 133
124 upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2; 134 upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2;
125 upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10; 135 upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10;
126 136
127 MediaWidget::resizeEvent( e ); 137 MediaWidget::resizeEvent( e );
128} 138}
129 139
130void AudioWidget::sliderPressed() { 140void AudioWidget::sliderPressed() {
131 audioSliderBeingMoved = TRUE; 141 audioSliderBeingMoved = TRUE;
132} 142}
133 143
134 144
135void AudioWidget::sliderReleased() { 145void AudioWidget::sliderReleased() {
136 audioSliderBeingMoved = FALSE; 146 audioSliderBeingMoved = FALSE;
137 if ( slider.width() == 0 ) 147 if ( slider.width() == 0 )
138 return; 148 return;
139 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); 149 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width());
140 mediaPlayerState.setPosition( val ); 150 mediaPlayerState.setPosition( val );
141} 151}
142 152
143void AudioWidget::setPosition( long i ) { 153void AudioWidget::setPosition( long i ) {
144 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 154 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
145 updateSlider( i, mediaPlayerState.length() ); 155 updateSlider( i, mediaPlayerState.length() );
146} 156}
147 157
148 158
149void AudioWidget::setLength( long max ) { 159void AudioWidget::setLength( long max ) {
150 updateSlider( mediaPlayerState.position(), max ); 160 updateSlider( mediaPlayerState.position(), max );
151} 161}
152 162
153 163
154void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { 164void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) {
155 if ( mediaType == MediaPlayerState::Audio ) { 165 if ( mediaType == MediaPlayerState::Audio ) {
156 // startTimer( 150 ); 166 // startTimer( 150 );
157 showMaximized(); 167 showMaximized();
158 return; 168 return;
159 } 169 }
160 170
161 killTimers(); 171 killTimers();
162 hide(); 172 hide();
163} 173}
164 174
165void AudioWidget::loadSkin() 175void AudioWidget::loadSkin()
166{ 176{
167 loadDefaultSkin( skinInfo, buttonCount ); 177 loadDefaultSkin( ::skinInfo, ::buttonCount );
168 178
169 setBackgroundPixmap( backgroundPixmap ); 179 setBackgroundPixmap( backgroundPixmap );
170 180
171 songInfo.setFocusPolicy( QWidget::NoFocus ); 181 songInfo.setFocusPolicy( QWidget::NoFocus );
172// changeTextColor( &songInfo ); 182// changeTextColor( &songInfo );
173// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 183// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
174// songInfo.setFrameStyle( QFrame::NoFrame); 184// songInfo.setFrameStyle( QFrame::NoFrame);
175 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); 185 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
176// songInfo.setForegroundColor(Qt::white); 186// songInfo.setForegroundColor(Qt::white);
177 187
178 slider.setFixedHeight( 20 ); 188 slider.setFixedHeight( 20 );
179 slider.setMinValue( 0 ); 189 slider.setMinValue( 0 );
180 slider.setMaxValue( 1 ); 190 slider.setMaxValue( 1 );
181 slider.setFocusPolicy( QWidget::NoFocus ); 191 slider.setFocusPolicy( QWidget::NoFocus );
182 slider.setBackgroundPixmap( backgroundPixmap ); 192 slider.setBackgroundPixmap( backgroundPixmap );
183 193
184// Config cofg("qpe"); 194// Config cofg("qpe");
185// cofg.setGroup("Appearance"); 195// cofg.setGroup("Appearance");
186// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); 196// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) );
187 197
188 time.setFocusPolicy( QWidget::NoFocus ); 198 time.setFocusPolicy( QWidget::NoFocus );
189 time.setAlignment( Qt::AlignCenter ); 199 time.setAlignment( Qt::AlignCenter );
190 200
191// time.setFrame(FALSE); 201// time.setFrame(FALSE);
192// changeTextColor( &time ); 202// changeTextColor( &time );
193 203
194 resizeEvent( 0 ); 204 resizeEvent( 0 );
195} 205}
196 206
197void AudioWidget::setSeekable( bool isSeekable ) { 207void AudioWidget::setSeekable( bool isSeekable ) {
198 208
199 if ( !isSeekable ) { 209 if ( !isSeekable ) {
200 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); 210 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
201 if( !slider.isHidden()) { 211 if( !slider.isHidden()) {
202 slider.hide(); 212 slider.hide();
203 } 213 }
204 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 214 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
205 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 215 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
206 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 216 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
207 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 217 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
208 } else { 218 } else {
209 // this stops the slider from being moved, thus 219 // this stops the slider from being moved, thus
210 // does not stop stream when it reaches the end 220 // does not stop stream when it reaches the end
211 slider.show(); 221 slider.show();
212 qDebug( " CONNECT SET POSTION " ); 222 qDebug( " CONNECT SET POSTION " );
213 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 223 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
214 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 224 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
215 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 225 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
216 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 226 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
217 } 227 }
218} 228}
219 229
220 230
221static QString timeAsString( long length ) { 231static QString timeAsString( long length ) {
222 int minutes = length / 60; 232 int minutes = length / 60;
223 int seconds = length % 60; 233 int seconds = length % 60;
224 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); 234 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 );
225} 235}
226 236
227void AudioWidget::updateSlider( long i, long max ) { 237void AudioWidget::updateSlider( long i, long max ) {
228 238
229 time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); 239 time.setText( timeAsString( i ) + " / " + timeAsString( max ) );
230// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; 240// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ;
231 241
232 if ( max == 0 ) { 242 if ( max == 0 ) {
233 return; 243 return;
234 } 244 }
235 // Will flicker too much if we don't do this 245 // Will flicker too much if we don't do this
236 // Scale to something reasonable 246 // Scale to something reasonable
237 int width = slider.width(); 247 int width = slider.width();
238 int val = int((double)i * width / max); 248 int val = int((double)i * width / max);
239 if ( !audioSliderBeingMoved ) { 249 if ( !audioSliderBeingMoved ) {
240 if ( slider.value() != val ) { 250 if ( slider.value() != val ) {
241 slider.setValue( val ); 251 slider.setValue( val );
242 } 252 }
243 253
244 if ( slider.maxValue() != width ) { 254 if ( slider.maxValue() != width ) {
245 slider.setMaxValue( width ); 255 slider.setMaxValue( width );
246 } 256 }
247 } 257 }
248} 258}
249 259
250void AudioWidget::skipFor() { 260void AudioWidget::skipFor() {
251 skipDirection = +1; 261 skipDirection = +1;
252 startTimer( 50 ); 262 startTimer( 50 );
253 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); 263 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 );
254} 264}
255 265
256void AudioWidget::skipBack() { 266void AudioWidget::skipBack() {
257 skipDirection = -1; 267 skipDirection = -1;
258 startTimer( 50 ); 268 startTimer( 50 );
259 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); 269 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
260} 270}
261 271
262 272
263 273
264void AudioWidget::stopSkip() { 274void AudioWidget::stopSkip() {
265 killTimers(); 275 killTimers();
266} 276}
267 277
268 278
269void AudioWidget::timerEvent( QTimerEvent * ) { 279void AudioWidget::timerEvent( QTimerEvent * ) {
270 if ( skipDirection == +1 ) { 280 if ( skipDirection == +1 ) {
271 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); 281 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 );
272 } else if ( skipDirection == -1 ) { 282 } else if ( skipDirection == -1 ) {
273 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); 283 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
274 } 284 }
275} 285}
276 286
277void AudioWidget::keyReleaseEvent( QKeyEvent *e) { 287void AudioWidget::keyReleaseEvent( QKeyEvent *e) {
278 switch ( e->key() ) { 288 switch ( e->key() ) {
279 ////////////////////////////// Zaurus keys 289 ////////////////////////////// Zaurus keys
280 case Key_Home: 290 case Key_Home:
281 break; 291 break;
282 case Key_F9: //activity 292 case Key_F9: //activity
283 hide(); 293 hide();
284 // qDebug("Audio F9"); 294 // qDebug("Audio F9");
285 e->accept(); 295 e->accept();
286 break; 296 break;
287 case Key_F10: //contacts 297 case Key_F10: //contacts
288 break; 298 break;
289 case Key_F11: //menu 299 case Key_F11: //menu
290 mediaPlayerState.toggleBlank(); 300 mediaPlayerState.toggleBlank();
291 e->accept(); 301 e->accept();
292 break; 302 break;
293 case Key_F12: //home 303 case Key_F12: //home
294 break; 304 break;
295 case Key_F13: //mail 305 case Key_F13: //mail
296 mediaPlayerState.toggleBlank(); 306 mediaPlayerState.toggleBlank();
297 e->accept(); 307 e->accept();
298 break; 308 break;
299 case Key_Space: { 309 case Key_Space: {
300 e->accept(); 310 e->accept();
301 mediaPlayerState.togglePaused(); 311 mediaPlayerState.togglePaused();
302 } 312 }
303 break; 313 break;
304 case Key_Down: 314 case Key_Down:
305 // toggleButton(6); 315 // toggleButton(6);
306 emit lessClicked(); 316 emit lessClicked();
307 emit lessReleased(); 317 emit lessReleased();
308 // toggleButton(6); 318 // toggleButton(6);
309 e->accept(); 319 e->accept();
310 break; 320 break;
311 case Key_Up: 321 case Key_Up:
312 // toggleButton(5); 322 // toggleButton(5);
313 emit moreClicked(); 323 emit moreClicked();
314 emit moreReleased(); 324 emit moreReleased();
315 // toggleButton(5); 325 // toggleButton(5);
316 e->accept(); 326 e->accept();
317 break; 327 break;
318 case Key_Right: 328 case Key_Right:
319 // toggleButton(3); 329 // toggleButton(3);
320 mediaPlayerState.setNext(); 330 mediaPlayerState.setNext();
321 // toggleButton(3); 331 // toggleButton(3);
322 e->accept(); 332 e->accept();
323 break; 333 break;
324 case Key_Left: 334 case Key_Left:
325 // toggleButton(4); 335 // toggleButton(4);
326 mediaPlayerState.setPrev(); 336 mediaPlayerState.setPrev();
327 // toggleButton(4); 337 // toggleButton(4);
328 e->accept(); 338 e->accept();
329 break; 339 break;
330 case Key_Escape: { 340 case Key_Escape: {
331 } 341 }
332 break; 342 break;
333 343
334 }; 344 };
335} 345}
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 670fb45..75d4857 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -1,99 +1,103 @@
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 AUDIO_WIDGET_H 34#ifndef AUDIO_WIDGET_H
35#define AUDIO_WIDGET_H 35#define AUDIO_WIDGET_H
36 36
37#include <qpainter.h> 37#include <qpainter.h>
38#include <qdrawutil.h> 38#include <qdrawutil.h>
39#include <qpixmap.h> 39#include <qpixmap.h>
40#include <qstring.h> 40#include <qstring.h>
41#include <qslider.h> 41#include <qslider.h>
42#include <qframe.h> 42#include <qframe.h>
43#include <qlineedit.h> 43#include <qlineedit.h>
44#include <qimage.h> 44#include <qimage.h>
45 45
46#include <opie/oticker.h> 46#include <opie/oticker.h>
47 47
48#include "mediawidget.h" 48#include "mediawidget.h"
49 49
50class QPixmap; 50class QPixmap;
51 51
52class AudioWidget : public MediaWidget { 52class AudioWidget : public MediaWidget {
53 Q_OBJECT 53 Q_OBJECT
54public: 54public:
55 AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); 55 AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
56 ~AudioWidget(); 56 ~AudioWidget();
57 void setTickerText( const QString &text ) { songInfo.setText( text ); } 57 void setTickerText( const QString &text ) { songInfo.setText( text ); }
58
59 static const MediaWidget::SkinButtonInfo *skinInfo();
60 static const uint buttonCount();
61
58public slots: 62public slots:
59 void updateSlider( long, long ); 63 void updateSlider( long, long );
60 void sliderPressed( ); 64 void sliderPressed( );
61 void sliderReleased( ); 65 void sliderReleased( );
62 void setLooping( bool b) { setToggleButton( Loop, b ); } 66 void setLooping( bool b) { setToggleButton( Loop, b ); }
63 void setPosition( long ); 67 void setPosition( long );
64 void setSeekable( bool ); 68 void setSeekable( bool );
65 69
66public: 70public:
67 virtual void setLength( long ); 71 virtual void setLength( long );
68 virtual void setPlaying( bool b) { setToggleButton( Play, b ); } 72 virtual void setPlaying( bool b) { setToggleButton( Play, b ); }
69 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 73 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
70 74
71 virtual void loadSkin(); 75 virtual void loadSkin();
72 76
73signals: 77signals:
74 void sliderMoved(long); 78 void sliderMoved(long);
75 79
76protected: 80protected:
77 void doBlank(); 81 void doBlank();
78 void doUnblank(); 82 void doUnblank();
79 void resizeEvent( QResizeEvent *re ); 83 void resizeEvent( QResizeEvent *re );
80 void timerEvent( QTimerEvent *event ); 84 void timerEvent( QTimerEvent *event );
81 void keyReleaseEvent( QKeyEvent *e); 85 void keyReleaseEvent( QKeyEvent *e);
82private slots: 86private slots:
83 void skipFor(); 87 void skipFor();
84 void skipBack(); 88 void skipBack();
85 void stopSkip(); 89 void stopSkip();
86private: 90private:
87 int skipDirection; 91 int skipDirection;
88 QString skin; 92 QString skin;
89 93
90 OTicker songInfo; 94 OTicker songInfo;
91 QSlider slider; 95 QSlider slider;
92 QLineEdit time; 96 QLineEdit time;
93 bool isStreaming : 1; 97 bool isStreaming : 1;
94 bool audioSliderBeingMoved : 1; 98 bool audioSliderBeingMoved : 1;
95}; 99};
96 100
97 101
98#endif // AUDIO_WIDGET_H 102#endif // AUDIO_WIDGET_H
99 103
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index a8ff540..058730f 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -1,311 +1,321 @@
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 ), videoSliderBeingMoved( false ) 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 videoFrame = new XineVideoWidget ( this, "Video frame" ); 82 videoFrame = new XineVideoWidget ( this, "Video frame" );
83 83
84 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 84 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
85 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 85 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
86 86
87 slider = 0; 87 slider = 0;
88 88
89 loadSkin(); 89 loadSkin();
90 90
91 setLength( mediaPlayerState.length() ); 91 setLength( mediaPlayerState.length() );
92 setPosition( mediaPlayerState.position() ); 92 setPosition( mediaPlayerState.position() );
93 setFullscreen( mediaPlayerState.isFullscreen() ); 93 setFullscreen( mediaPlayerState.isFullscreen() );
94 setPlaying( mediaPlayerState.isPlaying() ); 94 setPlaying( mediaPlayerState.isPlaying() );
95} 95}
96 96
97 97
98VideoWidget::~VideoWidget() 98VideoWidget::~VideoWidget()
99{ 99{
100} 100}
101 101
102const MediaWidget::SkinButtonInfo *VideoWidget::skinInfo()
103{
104 return ::skinInfo;
105}
106
107const uint VideoWidget::buttonCount()
108{
109 return ::buttonCount;
110}
111
102void VideoWidget::resizeEvent( QResizeEvent *e ) { 112void VideoWidget::resizeEvent( QResizeEvent *e ) {
103 int h = height(); 113 int h = height();
104 int w = width(); 114 int w = width();
105 //int Vh = 160; 115 //int Vh = 160;
106 //int Vw = 220; 116 //int Vw = 220;
107 117
108 slider->setFixedWidth( w - 20 ); 118 slider->setFixedWidth( w - 20 );
109 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 119 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
110 slider->setBackgroundOrigin( QWidget::ParentOrigin ); 120 slider->setBackgroundOrigin( QWidget::ParentOrigin );
111 slider->setFocusPolicy( QWidget::NoFocus ); 121 slider->setFocusPolicy( QWidget::NoFocus );
112 slider->setBackgroundPixmap( backgroundPixmap ); 122 slider->setBackgroundPixmap( backgroundPixmap );
113 123
114 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; 124 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2;
115 if(w>h) 125 if(w>h)
116 upperLeftOfButtonMask.ry() = 0; 126 upperLeftOfButtonMask.ry() = 0;
117 else 127 else
118 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; 128 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10;
119 129
120 MediaWidget::resizeEvent( e ); 130 MediaWidget::resizeEvent( e );
121} 131}
122 132
123void VideoWidget::sliderPressed() { 133void VideoWidget::sliderPressed() {
124 videoSliderBeingMoved = TRUE; 134 videoSliderBeingMoved = TRUE;
125} 135}
126 136
127void VideoWidget::sliderReleased() { 137void VideoWidget::sliderReleased() {
128 videoSliderBeingMoved = FALSE; 138 videoSliderBeingMoved = FALSE;
129 if ( slider->width() == 0 ) { 139 if ( slider->width() == 0 ) {
130 return; 140 return;
131 } 141 }
132 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); 142 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width());
133 mediaPlayerState.setPosition( val ); 143 mediaPlayerState.setPosition( val );
134} 144}
135 145
136void VideoWidget::setPosition( long i ) { 146void VideoWidget::setPosition( long i ) {
137 updateSlider( i, mediaPlayerState.length() ); 147 updateSlider( i, mediaPlayerState.length() );
138} 148}
139 149
140 150
141void VideoWidget::setLength( long max ) { 151void VideoWidget::setLength( long max ) {
142 updateSlider( mediaPlayerState.position(), max ); 152 updateSlider( mediaPlayerState.position(), max );
143} 153}
144 154
145void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) 155void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType )
146{ 156{
147 if ( displayType == MediaPlayerState::Video ) { 157 if ( displayType == MediaPlayerState::Video ) {
148 makeVisible(); 158 makeVisible();
149 return; 159 return;
150 } 160 }
151 161
152 // Effectively blank the view next time we show it so it looks nicer 162 // Effectively blank the view next time we show it so it looks nicer
153 scaledWidth = 0; 163 scaledWidth = 0;
154 scaledHeight = 0; 164 scaledHeight = 0;
155 hide(); 165 hide();
156} 166}
157 167
158void VideoWidget::loadSkin() 168void VideoWidget::loadSkin()
159{ 169{
160 loadDefaultSkin( skinInfo, buttonCount, "V" ); 170 loadDefaultSkin( ::skinInfo, ::buttonCount, "V" );
161 171
162 setBackgroundPixmap( backgroundPixmap ); 172 setBackgroundPixmap( backgroundPixmap );
163 173
164 delete slider; 174 delete slider;
165 slider = new QSlider( Qt::Horizontal, this ); 175 slider = new QSlider( Qt::Horizontal, this );
166 slider->setMinValue( 0 ); 176 slider->setMinValue( 0 );
167 slider->setMaxValue( 1 ); 177 slider->setMaxValue( 1 );
168 slider->setBackgroundPixmap( backgroundPixmap ); 178 slider->setBackgroundPixmap( backgroundPixmap );
169 //slider->setFocusPolicy( QWidget::NoFocus ); 179 //slider->setFocusPolicy( QWidget::NoFocus );
170 180
171 resizeEvent( 0 ); 181 resizeEvent( 0 );
172} 182}
173 183
174void VideoWidget::updateSlider( long i, long max ) { 184void VideoWidget::updateSlider( long i, long max ) {
175 // Will flicker too much if we don't do this 185 // Will flicker too much if we don't do this
176 if ( max == 0 ) { 186 if ( max == 0 ) {
177 return; 187 return;
178 } 188 }
179 int width = slider->width(); 189 int width = slider->width();
180 int val = int((double)i * width / max); 190 int val = int((double)i * width / max);
181 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { 191 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) {
182 if ( slider->value() != val ) { 192 if ( slider->value() != val ) {
183 slider->setValue( val ); 193 slider->setValue( val );
184 } 194 }
185 if ( slider->maxValue() != width ) { 195 if ( slider->maxValue() != width ) {
186 slider->setMaxValue( width ); 196 slider->setMaxValue( width );
187 } 197 }
188 } 198 }
189} 199}
190 200
191void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 201void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
192 if ( mediaPlayerState.isFullscreen() ) { 202 if ( mediaPlayerState.isFullscreen() ) {
193 mediaPlayerState.setFullscreen( FALSE ); 203 mediaPlayerState.setFullscreen( FALSE );
194 makeVisible(); 204 makeVisible();
195 } 205 }
196 MediaWidget::mouseReleaseEvent( event ); 206 MediaWidget::mouseReleaseEvent( event );
197} 207}
198 208
199void VideoWidget::backToNormal() { 209void VideoWidget::backToNormal() {
200 mediaPlayerState.setFullscreen( FALSE ); 210 mediaPlayerState.setFullscreen( FALSE );
201 makeVisible(); 211 makeVisible();
202} 212}
203 213
204void VideoWidget::makeVisible() { 214void VideoWidget::makeVisible() {
205 if ( mediaPlayerState.isFullscreen() ) { 215 if ( mediaPlayerState.isFullscreen() ) {
206 setBackgroundMode( QWidget::NoBackground ); 216 setBackgroundMode( QWidget::NoBackground );
207 showFullScreen(); 217 showFullScreen();
208 resize( qApp->desktop()->size() ); 218 resize( qApp->desktop()->size() );
209 videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); 219 videoFrame-> setGeometry ( 0, 0, width ( ), height ( ));
210 220
211 slider->hide(); 221 slider->hide();
212 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 222 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
213 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 223 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
214 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 224 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
215 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 225 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
216 226
217 } else { 227 } else {
218 showNormal(); 228 showNormal();
219 showMaximized(); 229 showMaximized();
220 setBackgroundPixmap( backgroundPixmap ); 230 setBackgroundPixmap( backgroundPixmap );
221 QWidget *d = QApplication::desktop(); 231 QWidget *d = QApplication::desktop();
222 int w = d->width(); 232 int w = d->width();
223 int h = d->height(); 233 int h = d->height();
224 234
225 if(w>h) { 235 if(w>h) {
226 int newW=(w/2)-(246/2); //this will only work with 320x240 236 int newW=(w/2)-(246/2); //this will only work with 320x240
227 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); 237 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) );
228 } else { 238 } else {
229 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); 239 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) );
230 } 240 }
231 241
232 if ( !mediaPlayerState.isSeekable() ) { 242 if ( !mediaPlayerState.isSeekable() ) {
233 if( !slider->isHidden()) { 243 if( !slider->isHidden()) {
234 slider->hide(); 244 slider->hide();
235 } 245 }
236 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 246 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
237 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 247 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
238 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 248 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
239 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 249 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
240 } else { 250 } else {
241 slider->show(); 251 slider->show();
242 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 252 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
243 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 253 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
244 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 254 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
245 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 255 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
246 } 256 }
247 } 257 }
248} 258}
249 259
250void VideoWidget::keyReleaseEvent( QKeyEvent *e) { 260void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
251 switch ( e->key() ) { 261 switch ( e->key() ) {
252////////////////////////////// Zaurus keys 262////////////////////////////// Zaurus keys
253 case Key_Home: 263 case Key_Home:
254 break; 264 break;
255 case Key_F9: //activity 265 case Key_F9: //activity
256 break; 266 break;
257 case Key_F10: //contacts 267 case Key_F10: //contacts
258// hide(); 268// hide();
259 break; 269 break;
260 case Key_F11: //menu 270 case Key_F11: //menu
261 break; 271 break;
262 case Key_F12: //home 272 case Key_F12: //home
263 break; 273 break;
264 case Key_F13: //mail 274 case Key_F13: //mail
265 break; 275 break;
266 case Key_Space: { 276 case Key_Space: {
267 if(mediaPlayerState.isPlaying()) { 277 if(mediaPlayerState.isPlaying()) {
268 mediaPlayerState.setPlaying(FALSE); 278 mediaPlayerState.setPlaying(FALSE);
269 } else { 279 } else {
270 mediaPlayerState.setPlaying(TRUE); 280 mediaPlayerState.setPlaying(TRUE);
271 } 281 }
272 } 282 }
273 break; 283 break;
274 case Key_Down: 284 case Key_Down:
275// toggleButton(6); 285// toggleButton(6);
276 emit lessClicked(); 286 emit lessClicked();
277 emit lessReleased(); 287 emit lessReleased();
278// toggleButton(6); 288// toggleButton(6);
279 break; 289 break;
280 case Key_Up: 290 case Key_Up:
281// toggleButton(5); 291// toggleButton(5);
282 emit moreClicked(); 292 emit moreClicked();
283 emit moreReleased(); 293 emit moreReleased();
284// toggleButton(5); 294// toggleButton(5);
285 break; 295 break;
286 case Key_Right: 296 case Key_Right:
287 mediaPlayerState.setNext(); 297 mediaPlayerState.setNext();
288 break; 298 break;
289 case Key_Left: 299 case Key_Left:
290 mediaPlayerState.setPrev(); 300 mediaPlayerState.setPrev();
291 break; 301 break;
292 case Key_Escape: 302 case Key_Escape:
293 break; 303 break;
294 304
295 }; 305 };
296} 306}
297 307
298XineVideoWidget* VideoWidget::vidWidget() { 308XineVideoWidget* VideoWidget::vidWidget() {
299 return videoFrame; 309 return videoFrame;
300} 310}
301 311
302 312
303void VideoWidget::setFullscreen ( bool b ) { 313void VideoWidget::setFullscreen ( bool b ) {
304 setToggleButton( FullScreen, b ); 314 setToggleButton( FullScreen, b );
305} 315}
306 316
307 317
308void VideoWidget::setPlaying( bool b) { 318void VideoWidget::setPlaying( bool b) {
309 setToggleButton( Play, b ); 319 setToggleButton( Play, b );
310} 320}
311 321
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index f434945..80e9356 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -1,98 +1,100 @@
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 static const MediaWidget::SkinButtonInfo *skinInfo();
54 static const uint buttonCount();
53 55
54 XineVideoWidget* vidWidget(); 56 XineVideoWidget* vidWidget();
55public slots: 57public slots:
56 void updateSlider( long, long ); 58 void updateSlider( long, long );
57 void sliderPressed( ); 59 void sliderPressed( );
58 void sliderReleased( ); 60 void sliderReleased( );
59 void setFullscreen( bool b ); 61 void setFullscreen( bool b );
60 virtual void makeVisible(); 62 virtual void makeVisible();
61 void backToNormal(); 63 void backToNormal();
62 void setPosition( long ); 64 void setPosition( long );
63 65
64public: 66public:
65 virtual void setPlaying( bool b); 67 virtual void setPlaying( bool b);
66 virtual void setLength( long ); 68 virtual void setLength( long );
67 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 69 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
68 70
69 virtual void loadSkin(); 71 virtual void loadSkin();
70 72
71signals: 73signals:
72 void moreClicked(); 74 void moreClicked();
73 void lessClicked(); 75 void lessClicked();
74 void sliderMoved( long ); 76 void sliderMoved( long );
75 void videoResized ( const QSize &s ); 77 void videoResized ( const QSize &s );
76 78
77protected: 79protected:
78 80
79 void resizeEvent( QResizeEvent * ); 81 void resizeEvent( QResizeEvent * );
80 void mouseReleaseEvent( QMouseEvent *event ); 82 void mouseReleaseEvent( QMouseEvent *event );
81 void keyReleaseEvent( QKeyEvent *e); 83 void keyReleaseEvent( QKeyEvent *e);
82 84
83private: 85private:
84// Ticker songInfo; 86// Ticker songInfo;
85 87
86 QSlider *slider; 88 QSlider *slider;
87 QImage *currentFrame; 89 QImage *currentFrame;
88 int scaledWidth; 90 int scaledWidth;
89 int scaledHeight; 91 int scaledHeight;
90 XineVideoWidget* videoFrame; 92 XineVideoWidget* videoFrame;
91 93
92 bool videoSliderBeingMoved; 94 bool videoSliderBeingMoved;
93}; 95};
94 96
95#endif // VIDEO_WIDGET_H 97#endif // VIDEO_WIDGET_H
96 98
97 99
98 100