-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 33 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 16 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/nullvideo.c | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 7 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 7 |
8 files changed, 46 insertions, 26 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index a6fd334..00d516c 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -64,400 +64,401 @@ Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) { | |||
64 | Ticker::~Ticker() { | 64 | Ticker::~Ticker() { |
65 | } | 65 | } |
66 | 66 | ||
67 | void Ticker::setText( const QString& text ) { | 67 | void Ticker::setText( const QString& text ) { |
68 | pos = 0; // reset it everytime the text is changed | 68 | pos = 0; // reset it everytime the text is changed |
69 | scrollText = text; | 69 | scrollText = text; |
70 | pixelLen = fontMetrics().width( scrollText ); | 70 | pixelLen = fontMetrics().width( scrollText ); |
71 | killTimers(); | 71 | killTimers(); |
72 | if ( pixelLen > width() ) { | 72 | if ( pixelLen > width() ) { |
73 | startTimer( 50 ); | 73 | startTimer( 50 ); |
74 | } | 74 | } |
75 | update(); | 75 | update(); |
76 | } | 76 | } |
77 | 77 | ||
78 | 78 | ||
79 | void Ticker::timerEvent( QTimerEvent * ) { | 79 | void Ticker::timerEvent( QTimerEvent * ) { |
80 | pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; | 80 | pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; |
81 | scroll( -1, 0, contentsRect() ); | 81 | scroll( -1, 0, contentsRect() ); |
82 | repaint( FALSE ); | 82 | repaint( FALSE ); |
83 | } | 83 | } |
84 | 84 | ||
85 | void Ticker::drawContents( QPainter *p ) { | 85 | void Ticker::drawContents( QPainter *p ) { |
86 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) { | 86 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) { |
87 | p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | 87 | p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); |
88 | } | 88 | } |
89 | QPixmap pm( width(), height() ); | 89 | QPixmap pm( width(), height() ); |
90 | pm.fill( colorGroup().base() ); | 90 | pm.fill( colorGroup().base() ); |
91 | QPainter pmp( &pm ); | 91 | QPainter pmp( &pm ); |
92 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) { | 92 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) { |
93 | pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | 93 | pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); |
94 | } | 94 | } |
95 | p->drawPixmap( 0, 0, pm ); | 95 | p->drawPixmap( 0, 0, pm ); |
96 | } | 96 | } |
97 | 97 | ||
98 | struct MediaButton { | 98 | struct MediaButton { |
99 | bool isToggle, isHeld, isDown; | 99 | bool isToggle, isHeld, isDown; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | //Layout information for the audioButtons (and if it is a toggle button or not) | 102 | //Layout information for the audioButtons (and if it is a toggle button or not) |
103 | MediaButton audioButtons[] = { | 103 | MediaButton audioButtons[] = { |
104 | { TRUE, FALSE, FALSE }, // play | 104 | { TRUE, FALSE, FALSE }, // play |
105 | { FALSE, FALSE, FALSE }, // stop | 105 | { FALSE, FALSE, FALSE }, // stop |
106 | { FALSE, FALSE, FALSE }, // next | 106 | { FALSE, FALSE, FALSE }, // next |
107 | { FALSE, FALSE, FALSE }, // previous | 107 | { FALSE, FALSE, FALSE }, // previous |
108 | { FALSE, FALSE, FALSE }, // volume up | 108 | { FALSE, FALSE, FALSE }, // volume up |
109 | { FALSE, FALSE, FALSE }, // volume down | 109 | { FALSE, FALSE, FALSE }, // volume down |
110 | { TRUE, FALSE, FALSE }, // repeat/loop | 110 | { TRUE, FALSE, FALSE }, // repeat/loop |
111 | { FALSE, FALSE, FALSE }, // playlist | 111 | { FALSE, FALSE, FALSE }, // playlist |
112 | { FALSE, FALSE, FALSE }, // forward | 112 | { FALSE, FALSE, FALSE }, // forward |
113 | { FALSE, FALSE, FALSE } // back | 113 | { FALSE, FALSE, FALSE } // back |
114 | }; | 114 | }; |
115 | 115 | ||
116 | const char *skin_mask_file_names[10] = { | 116 | const char *skin_mask_file_names[10] = { |
117 | "play", "stop", "next", "prev", "up", | 117 | "play", "stop", "next", "prev", "up", |
118 | "down", "loop", "playlist", "forward", "back" | 118 | "down", "loop", "playlist", "forward", "back" |
119 | }; | 119 | }; |
120 | 120 | ||
121 | 121 | ||
122 | static void changeTextColor( QWidget *w ) { | 122 | static void changeTextColor( QWidget *w ) { |
123 | QPalette p = w->palette(); | 123 | QPalette p = w->palette(); |
124 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); | 124 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); |
125 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | 125 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); |
126 | w->setPalette( p ); | 126 | w->setPalette( p ); |
127 | } | 127 | } |
128 | 128 | ||
129 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | 129 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); |
130 | 130 | ||
131 | 131 | ||
132 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 132 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
133 | 133 | ||
134 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { | 134 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { |
135 | 135 | ||
136 | setCaption( tr("OpiePlayer") ); | 136 | setCaption( tr("OpiePlayer") ); |
137 | 137 | ||
138 | Config cfg("OpiePlayer"); | 138 | Config cfg("OpiePlayer"); |
139 | cfg.setGroup("Options"); | 139 | cfg.setGroup("Options"); |
140 | skin = cfg.readEntry("Skin","default"); | 140 | skin = cfg.readEntry("Skin","default"); |
141 | //skin = "scaleTest"; | 141 | //skin = "scaleTest"; |
142 | // color of background, frame, degree of transparency | 142 | // color of background, frame, degree of transparency |
143 | 143 | ||
144 | QString skinPath = "opieplayer2/skins/" + skin; | 144 | QString skinPath = "opieplayer2/skins/" + skin; |
145 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 145 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
146 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | 146 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); |
147 | imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); | 147 | imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); |
148 | 148 | ||
149 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | 149 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); |
150 | imgButtonMask->fill( 0 ); | 150 | imgButtonMask->fill( 0 ); |
151 | 151 | ||
152 | for ( int i = 0; i < 10; i++ ) { | 152 | for ( int i = 0; i < 10; i++ ) { |
153 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); | 153 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); |
154 | masks[i] = new QBitmap( filename ); | 154 | masks[i] = new QBitmap( filename ); |
155 | 155 | ||
156 | if ( !masks[i]->isNull() ) { | 156 | if ( !masks[i]->isNull() ) { |
157 | QImage imgMask = masks[i]->convertToImage(); | 157 | QImage imgMask = masks[i]->convertToImage(); |
158 | uchar **dest = imgButtonMask->jumpTable(); | 158 | uchar **dest = imgButtonMask->jumpTable(); |
159 | for ( int y = 0; y < imgUp->height(); y++ ) { | 159 | for ( int y = 0; y < imgUp->height(); y++ ) { |
160 | uchar *line = dest[y]; | 160 | uchar *line = dest[y]; |
161 | for ( int x = 0; x < imgUp->width(); x++ ) | 161 | for ( int x = 0; x < imgUp->width(); x++ ) |
162 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 162 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
163 | line[x] = i + 1; | 163 | line[x] = i + 1; |
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | } | 167 | } |
168 | 168 | ||
169 | for ( int i = 0; i < 10; i++ ) { | 169 | for ( int i = 0; i < 10; i++ ) { |
170 | buttonPixUp[i] = 0l; | 170 | buttonPixUp[i] = 0l; |
171 | buttonPixDown[i] = 0l; | 171 | buttonPixDown[i] = 0l; |
172 | } | 172 | } |
173 | 173 | ||
174 | setBackgroundPixmap( *pixBg ); | 174 | setBackgroundPixmap( *pixBg ); |
175 | 175 | ||
176 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 176 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
177 | changeTextColor( &songInfo ); | 177 | changeTextColor( &songInfo ); |
178 | 178 | ||
179 | slider.setFixedHeight( 20 ); | 179 | slider.setFixedHeight( 20 ); |
180 | slider.setMinValue( 0 ); | 180 | slider.setMinValue( 0 ); |
181 | slider.setMaxValue( 1 ); | 181 | slider.setMaxValue( 1 ); |
182 | slider.setFocusPolicy( QWidget::NoFocus ); | 182 | slider.setFocusPolicy( QWidget::NoFocus ); |
183 | slider.setBackgroundPixmap( *pixBg ); | 183 | slider.setBackgroundPixmap( *pixBg ); |
184 | 184 | ||
185 | time.setFocusPolicy( QWidget::NoFocus ); | 185 | time.setFocusPolicy( QWidget::NoFocus ); |
186 | time.setAlignment( Qt::AlignCenter ); | 186 | time.setAlignment( Qt::AlignCenter ); |
187 | time.setFrame(FALSE); | 187 | time.setFrame(FALSE); |
188 | changeTextColor( &time ); | 188 | changeTextColor( &time ); |
189 | 189 | ||
190 | resizeEvent( NULL ); | 190 | resizeEvent( NULL ); |
191 | 191 | ||
192 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 192 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
193 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 193 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
194 | 194 | ||
195 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 195 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
196 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 196 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
197 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 197 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
198 | // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | ||
199 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 198 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
199 | connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); | ||
200 | 200 | ||
201 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | 201 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); |
202 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); | 202 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); |
203 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); | 203 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); |
204 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); | 204 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); |
205 | 205 | ||
206 | |||
207 | |||
208 | // Intialise state | 206 | // Intialise state |
209 | setLength( mediaPlayerState->length() ); | 207 | setLength( mediaPlayerState->length() ); |
210 | setPosition( mediaPlayerState->position() ); | 208 | setPosition( mediaPlayerState->position() ); |
211 | setLooping( mediaPlayerState->fullscreen() ); | 209 | setLooping( mediaPlayerState->fullscreen() ); |
212 | // setPaused( mediaPlayerState->paused() ); | 210 | // setPaused( mediaPlayerState->paused() ); |
213 | setPlaying( mediaPlayerState->playing() ); | 211 | setPlaying( mediaPlayerState->playing() ); |
214 | 212 | ||
215 | } | 213 | } |
216 | 214 | ||
217 | AudioWidget::~AudioWidget() { | 215 | AudioWidget::~AudioWidget() { |
218 | 216 | ||
219 | for ( int i = 0; i < 10; i++ ) { | 217 | for ( int i = 0; i < 10; i++ ) { |
220 | delete buttonPixUp[i]; | 218 | delete buttonPixUp[i]; |
221 | delete buttonPixDown[i]; | 219 | delete buttonPixDown[i]; |
222 | } | 220 | } |
223 | delete pixBg; | 221 | delete pixBg; |
224 | delete imgUp; | 222 | delete imgUp; |
225 | delete imgDn; | 223 | delete imgDn; |
226 | delete imgButtonMask; | 224 | delete imgButtonMask; |
227 | for ( int i = 0; i < 10; i++ ) { | 225 | for ( int i = 0; i < 10; i++ ) { |
228 | delete masks[i]; | 226 | delete masks[i]; |
229 | } | 227 | } |
230 | // mediaPlayerState->setPlaying(false); | 228 | // mediaPlayerState->setPlaying(false); |
231 | } | 229 | } |
232 | 230 | ||
233 | namespace { | 231 | namespace { |
234 | 232 | ||
235 | QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 233 | QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
236 | QPixmap pix( img.width(), img.height() ); | 234 | QPixmap pix( img.width(), img.height() ); |
237 | QPainter p( &pix ); | 235 | QPainter p( &pix ); |
238 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 236 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
239 | p.drawImage( 0, 0, img ); | 237 | p.drawImage( 0, 0, img ); |
240 | return new QPixmap( pix ); | 238 | return new QPixmap( pix ); |
241 | } | 239 | } |
242 | 240 | ||
243 | 241 | ||
244 | QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) { | 242 | QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) { |
245 | QPixmap *pixmap = new QPixmap( pix ); | 243 | QPixmap *pixmap = new QPixmap( pix ); |
246 | pixmap->setMask( mask ); | 244 | pixmap->setMask( mask ); |
247 | return pixmap; | 245 | return pixmap; |
248 | } | 246 | } |
249 | 247 | ||
250 | }; | 248 | }; |
251 | 249 | ||
252 | void AudioWidget::resizeEvent( QResizeEvent * ) { | 250 | void AudioWidget::resizeEvent( QResizeEvent * ) { |
253 | int h = height(); | 251 | int h = height(); |
254 | int w = width(); | 252 | int w = width(); |
255 | 253 | ||
256 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); | 254 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); |
257 | slider.setFixedWidth( w - 110 ); | 255 | slider.setFixedWidth( w - 110 ); |
258 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 256 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
259 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); | 257 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); |
260 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | 258 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); |
261 | 259 | ||
262 | xoff = ( w - imgUp->width() ) / 2; | 260 | xoff = ( w - imgUp->width() ) / 2; |
263 | yoff = (( h - imgUp->height() ) / 2) - 10; | 261 | yoff = (( h - imgUp->height() ) / 2) - 10; |
264 | QPoint p( xoff, yoff ); | 262 | QPoint p( xoff, yoff ); |
265 | 263 | ||
266 | QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p ); | 264 | QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p ); |
267 | QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p ); | 265 | QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p ); |
268 | 266 | ||
269 | for ( int i = 0; i < 10; i++ ) { | 267 | for ( int i = 0; i < 10; i++ ) { |
270 | if ( !masks[i]->isNull() ) { | 268 | if ( !masks[i]->isNull() ) { |
271 | delete buttonPixUp[i]; | 269 | delete buttonPixUp[i]; |
272 | delete buttonPixDown[i]; | 270 | delete buttonPixDown[i]; |
273 | buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] ); | 271 | buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] ); |
274 | buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] ); | 272 | buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] ); |
275 | } | 273 | } |
276 | } | 274 | } |
277 | 275 | ||
278 | delete pixUp; | 276 | delete pixUp; |
279 | delete pixDn; | 277 | delete pixDn; |
280 | } | 278 | } |
281 | 279 | ||
282 | static bool audioSliderBeingMoved = FALSE; | 280 | static bool audioSliderBeingMoved = FALSE; |
283 | 281 | ||
284 | 282 | ||
285 | void AudioWidget::sliderPressed() { | 283 | void AudioWidget::sliderPressed() { |
286 | audioSliderBeingMoved = TRUE; | 284 | audioSliderBeingMoved = TRUE; |
287 | } | 285 | } |
288 | 286 | ||
289 | 287 | ||
290 | void AudioWidget::sliderReleased() { | 288 | void AudioWidget::sliderReleased() { |
291 | audioSliderBeingMoved = FALSE; | 289 | audioSliderBeingMoved = FALSE; |
292 | if ( slider.width() == 0 ) | 290 | if ( slider.width() == 0 ) |
293 | return; | 291 | return; |
294 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); | 292 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); |
295 | mediaPlayerState->setPosition( val ); | 293 | mediaPlayerState->setPosition( val ); |
296 | } | 294 | } |
297 | 295 | ||
298 | void AudioWidget::setPosition( long i ) { | 296 | void AudioWidget::setPosition( long i ) { |
299 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); | 297 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); |
300 | updateSlider( i, mediaPlayerState->length() ); | 298 | updateSlider( i, mediaPlayerState->length() ); |
301 | } | 299 | } |
302 | 300 | ||
303 | 301 | ||
304 | void AudioWidget::setLength( long max ) { | 302 | void AudioWidget::setLength( long max ) { |
305 | updateSlider( mediaPlayerState->position(), max ); | 303 | updateSlider( mediaPlayerState->position(), max ); |
306 | } | 304 | } |
307 | 305 | ||
308 | 306 | ||
309 | void AudioWidget::setView( char view ) { | 307 | void AudioWidget::setView( char view ) { |
310 | 308 | ||
311 | // this isnt working for some reason | 309 | if ( view == 'a' ) { |
310 | // startTimer( 150 ); | ||
311 | showMaximized(); | ||
312 | } else { | ||
313 | killTimers(); | ||
314 | hide(); | ||
315 | } | ||
316 | // qApp->processEvents(); | ||
317 | } | ||
318 | |||
319 | |||
320 | void AudioWidget::setSeekable( bool isSeekable ) { | ||
312 | 321 | ||
313 | if ( mediaPlayerState->streaming() ) { | 322 | if ( isSeekable ) { |
314 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); | 323 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); |
315 | if( !slider.isHidden()) { | 324 | if( !slider.isHidden()) { |
316 | slider.hide(); | 325 | slider.hide(); |
317 | } | 326 | } |
318 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 327 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
319 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 328 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
320 | } else { | 329 | } else { |
321 | // this stops the slider from being moved, thus | 330 | // this stops the slider from being moved, thus |
322 | // does not stop stream when it reaches the end | 331 | // does not stop stream when it reaches the end |
323 | slider.show(); | 332 | slider.show(); |
333 | qDebug( " CONNECT SET POSTION " ); | ||
324 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 334 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
325 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 335 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
326 | } | 336 | } |
327 | |||
328 | if ( view == 'a' ) { | ||
329 | // startTimer( 150 ); | ||
330 | showMaximized(); | ||
331 | } else { | ||
332 | killTimers(); | ||
333 | hide(); | ||
334 | } | ||
335 | // qApp->processEvents(); | ||
336 | } | 337 | } |
337 | 338 | ||
338 | 339 | ||
339 | static QString timeAsString( long length ) { | 340 | static QString timeAsString( long length ) { |
340 | int minutes = length / 60; | 341 | int minutes = length / 60; |
341 | int seconds = length % 60; | 342 | int seconds = length % 60; |
342 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); | 343 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); |
343 | } | 344 | } |
344 | 345 | ||
345 | void AudioWidget::updateSlider( long i, long max ) { | 346 | void AudioWidget::updateSlider( long i, long max ) { |
346 | 347 | ||
347 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); | 348 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); |
348 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; | 349 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; |
349 | 350 | ||
350 | if ( max == 0 ) { | 351 | if ( max == 0 ) { |
351 | return; | 352 | return; |
352 | } | 353 | } |
353 | // Will flicker too much if we don't do this | 354 | // Will flicker too much if we don't do this |
354 | // Scale to something reasonable | 355 | // Scale to something reasonable |
355 | int width = slider.width(); | 356 | int width = slider.width(); |
356 | int val = int((double)i * width / max); | 357 | int val = int((double)i * width / max); |
357 | if ( !audioSliderBeingMoved ) { | 358 | if ( !audioSliderBeingMoved ) { |
358 | if ( slider.value() != val ) { | 359 | if ( slider.value() != val ) { |
359 | slider.setValue( val ); | 360 | slider.setValue( val ); |
360 | } | 361 | } |
361 | 362 | ||
362 | if ( slider.maxValue() != width ) { | 363 | if ( slider.maxValue() != width ) { |
363 | slider.setMaxValue( width ); | 364 | slider.setMaxValue( width ); |
364 | } | 365 | } |
365 | } | 366 | } |
366 | } | 367 | } |
367 | 368 | ||
368 | 369 | ||
369 | void AudioWidget::setToggleButton( int i, bool down ) { | 370 | void AudioWidget::setToggleButton( int i, bool down ) { |
370 | qDebug("setToggleButton %d", i); | 371 | qDebug("setToggleButton %d", i); |
371 | if ( down != audioButtons[i].isDown ) { | 372 | if ( down != audioButtons[i].isDown ) { |
372 | toggleButton( i ); | 373 | toggleButton( i ); |
373 | } | 374 | } |
374 | } | 375 | } |
375 | 376 | ||
376 | 377 | ||
377 | void AudioWidget::toggleButton( int i ) { | 378 | void AudioWidget::toggleButton( int i ) { |
378 | audioButtons[i].isDown = !audioButtons[i].isDown; | 379 | audioButtons[i].isDown = !audioButtons[i].isDown; |
379 | QPainter p(this); | 380 | QPainter p(this); |
380 | paintButton ( &p, i ); | 381 | paintButton ( &p, i ); |
381 | } | 382 | } |
382 | 383 | ||
383 | 384 | ||
384 | void AudioWidget::paintButton( QPainter *p, int i ) { | 385 | void AudioWidget::paintButton( QPainter *p, int i ) { |
385 | if ( audioButtons[i].isDown ) { | 386 | if ( audioButtons[i].isDown ) { |
386 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 387 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
387 | } else { | 388 | } else { |
388 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 389 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
389 | } | 390 | } |
390 | } | 391 | } |
391 | 392 | ||
392 | 393 | ||
393 | void AudioWidget::skipFor() { | 394 | void AudioWidget::skipFor() { |
394 | skipDirection = +1; | 395 | skipDirection = +1; |
395 | startTimer( 50 ); | 396 | startTimer( 50 ); |
396 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); | 397 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); |
397 | } | 398 | } |
398 | 399 | ||
399 | void AudioWidget::skipBack() { | 400 | void AudioWidget::skipBack() { |
400 | skipDirection = -1; | 401 | skipDirection = -1; |
401 | startTimer( 50 ); | 402 | startTimer( 50 ); |
402 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); | 403 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); |
403 | } | 404 | } |
404 | 405 | ||
405 | 406 | ||
406 | 407 | ||
407 | void AudioWidget::stopSkip() { | 408 | void AudioWidget::stopSkip() { |
408 | killTimers(); | 409 | killTimers(); |
409 | } | 410 | } |
410 | 411 | ||
411 | 412 | ||
412 | void AudioWidget::timerEvent( QTimerEvent * ) { | 413 | void AudioWidget::timerEvent( QTimerEvent * ) { |
413 | if ( skipDirection == +1 ) { | 414 | if ( skipDirection == +1 ) { |
414 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); | 415 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); |
415 | } else if ( skipDirection == -1 ) { | 416 | } else if ( skipDirection == -1 ) { |
416 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); | 417 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); |
417 | } | 418 | } |
418 | } | 419 | } |
419 | 420 | ||
420 | 421 | ||
421 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 422 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
422 | for ( int i = 0; i < numButtons; i++ ) { | 423 | for ( int i = 0; i < numButtons; i++ ) { |
423 | if ( event->state() == QMouseEvent::LeftButton ) { | 424 | if ( event->state() == QMouseEvent::LeftButton ) { |
424 | // The test to see if the mouse click is inside the button or not | 425 | // The test to see if the mouse click is inside the button or not |
425 | int x = event->pos().x() - xoff; | 426 | int x = event->pos().x() - xoff; |
426 | int y = event->pos().y() - yoff; | 427 | int y = event->pos().y() - yoff; |
427 | 428 | ||
428 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 429 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
429 | && y < imgButtonMask->height() | 430 | && y < imgButtonMask->height() |
430 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 431 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
431 | 432 | ||
432 | if ( isOnButton && !audioButtons[i].isHeld ) { | 433 | if ( isOnButton && !audioButtons[i].isHeld ) { |
433 | audioButtons[i].isHeld = TRUE; | 434 | audioButtons[i].isHeld = TRUE; |
434 | toggleButton(i); | 435 | toggleButton(i); |
435 | switch (i) { | 436 | switch (i) { |
436 | case AudioVolumeUp: | 437 | case AudioVolumeUp: |
437 | emit moreClicked(); | 438 | emit moreClicked(); |
438 | return; | 439 | return; |
439 | case AudioVolumeDown: | 440 | case AudioVolumeDown: |
440 | emit lessClicked(); | 441 | emit lessClicked(); |
441 | return; | 442 | return; |
442 | case AudioForward: | 443 | case AudioForward: |
443 | emit forwardClicked(); | 444 | emit forwardClicked(); |
444 | return; | 445 | return; |
445 | case AudioBack: | 446 | case AudioBack: |
446 | emit backClicked(); | 447 | emit backClicked(); |
447 | return; | 448 | return; |
448 | } | 449 | } |
449 | } else if ( !isOnButton && audioButtons[i].isHeld ) { | 450 | } else if ( !isOnButton && audioButtons[i].isHeld ) { |
450 | audioButtons[i].isHeld = FALSE; | 451 | audioButtons[i].isHeld = FALSE; |
451 | toggleButton(i); | 452 | toggleButton(i); |
452 | } | 453 | } |
453 | } else { | 454 | } else { |
454 | if ( audioButtons[i].isHeld ) { | 455 | if ( audioButtons[i].isHeld ) { |
455 | audioButtons[i].isHeld = FALSE; | 456 | audioButtons[i].isHeld = FALSE; |
456 | if ( !audioButtons[i].isToggle ) { | 457 | if ( !audioButtons[i].isToggle ) { |
457 | setToggleButton( i, FALSE ); | 458 | setToggleButton( i, FALSE ); |
458 | } | 459 | } |
459 | qDebug("mouseEvent %d", i); | 460 | qDebug("mouseEvent %d", i); |
460 | switch (i) { | 461 | switch (i) { |
461 | case AudioPlay: | 462 | case AudioPlay: |
462 | if( mediaPlayerState->isPaused ) { | 463 | if( mediaPlayerState->isPaused ) { |
463 | mediaPlayerState->setPaused( FALSE ); | 464 | mediaPlayerState->setPaused( FALSE ); |
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index c544882..09dc19b 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -1,150 +1,151 @@ | |||
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 <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include <qpainter.h> | 38 | #include <qpainter.h> |
39 | #include <qdrawutil.h> | 39 | #include <qdrawutil.h> |
40 | #include <qpixmap.h> | 40 | #include <qpixmap.h> |
41 | #include <qstring.h> | 41 | #include <qstring.h> |
42 | #include <qslider.h> | 42 | #include <qslider.h> |
43 | #include <qframe.h> | 43 | #include <qframe.h> |
44 | #include <qlineedit.h> | 44 | #include <qlineedit.h> |
45 | 45 | ||
46 | 46 | ||
47 | class QPixmap; | 47 | class QPixmap; |
48 | 48 | ||
49 | namespace { | 49 | namespace { |
50 | 50 | ||
51 | enum AudioButtons { | 51 | enum AudioButtons { |
52 | AudioPlay=0, | 52 | AudioPlay=0, |
53 | AudioStop, | 53 | AudioStop, |
54 | AudioNext, | 54 | AudioNext, |
55 | AudioPrevious, | 55 | AudioPrevious, |
56 | AudioVolumeUp, | 56 | AudioVolumeUp, |
57 | AudioVolumeDown, | 57 | AudioVolumeDown, |
58 | AudioLoop, | 58 | AudioLoop, |
59 | AudioPlayList, | 59 | AudioPlayList, |
60 | AudioForward, | 60 | AudioForward, |
61 | AudioBack | 61 | AudioBack |
62 | }; | 62 | }; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | class Ticker : public QFrame { | 65 | class Ticker : public QFrame { |
66 | Q_OBJECT | 66 | Q_OBJECT |
67 | 67 | ||
68 | public: | 68 | public: |
69 | Ticker( QWidget* parent=0 ); | 69 | Ticker( QWidget* parent=0 ); |
70 | ~Ticker(); | 70 | ~Ticker(); |
71 | void setText( const QString& text ) ; | 71 | void setText( const QString& text ) ; |
72 | 72 | ||
73 | protected: | 73 | protected: |
74 | void timerEvent( QTimerEvent * ); | 74 | void timerEvent( QTimerEvent * ); |
75 | void drawContents( QPainter *p ); | 75 | void drawContents( QPainter *p ); |
76 | private: | 76 | private: |
77 | QString scrollText; | 77 | QString scrollText; |
78 | int pos, pixelLen; | 78 | int pos, pixelLen; |
79 | }; | 79 | }; |
80 | 80 | ||
81 | 81 | ||
82 | class AudioWidget : public QWidget { | 82 | class AudioWidget : public QWidget { |
83 | Q_OBJECT | 83 | Q_OBJECT |
84 | public: | 84 | public: |
85 | AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 85 | AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
86 | ~AudioWidget(); | 86 | ~AudioWidget(); |
87 | void setTickerText( const QString &text ) { songInfo.setText( text ); } | 87 | void setTickerText( const QString &text ) { songInfo.setText( text ); } |
88 | public slots: | 88 | public slots: |
89 | void updateSlider( long, long ); | 89 | void updateSlider( long, long ); |
90 | void sliderPressed( ); | 90 | void sliderPressed( ); |
91 | void sliderReleased( ); | 91 | void sliderReleased( ); |
92 | // void setPaused( bool b) { setToggleButton( AudioPause, b ); } | 92 | // void setPaused( bool b) { setToggleButton( AudioPause, b ); } |
93 | void setLooping( bool b) { setToggleButton( AudioLoop, b ); } | 93 | void setLooping( bool b) { setToggleButton( AudioLoop, b ); } |
94 | void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } | 94 | void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } |
95 | void setPosition( long ); | 95 | void setPosition( long ); |
96 | void setLength( long ); | 96 | void setLength( long ); |
97 | void setSeekable( bool ); | ||
97 | void setView( char ); | 98 | void setView( char ); |
98 | 99 | ||
99 | signals: | 100 | signals: |
100 | void moreClicked(); | 101 | void moreClicked(); |
101 | void lessClicked(); | 102 | void lessClicked(); |
102 | void moreReleased(); | 103 | void moreReleased(); |
103 | void lessReleased(); | 104 | void lessReleased(); |
104 | void forwardClicked(); | 105 | void forwardClicked(); |
105 | void backClicked(); | 106 | void backClicked(); |
106 | void forwardReleased(); | 107 | void forwardReleased(); |
107 | void backReleased(); | 108 | void backReleased(); |
108 | void sliderMoved(long); | 109 | void sliderMoved(long); |
109 | 110 | ||
110 | protected: | 111 | protected: |
111 | void doBlank(); | 112 | void doBlank(); |
112 | void doUnblank(); | 113 | void doUnblank(); |
113 | void paintEvent( QPaintEvent *pe ); | 114 | void paintEvent( QPaintEvent *pe ); |
114 | void showEvent( QShowEvent *se ); | 115 | void showEvent( QShowEvent *se ); |
115 | void resizeEvent( QResizeEvent *re ); | 116 | void resizeEvent( QResizeEvent *re ); |
116 | void mouseMoveEvent( QMouseEvent *event ); | 117 | void mouseMoveEvent( QMouseEvent *event ); |
117 | void mousePressEvent( QMouseEvent *event ); | 118 | void mousePressEvent( QMouseEvent *event ); |
118 | void mouseReleaseEvent( QMouseEvent *event ); | 119 | void mouseReleaseEvent( QMouseEvent *event ); |
119 | void timerEvent( QTimerEvent *event ); | 120 | void timerEvent( QTimerEvent *event ); |
120 | void closeEvent( QCloseEvent *event ); | 121 | void closeEvent( QCloseEvent *event ); |
121 | void keyReleaseEvent( QKeyEvent *e); | 122 | void keyReleaseEvent( QKeyEvent *e); |
122 | private slots: | 123 | private slots: |
123 | void skipFor(); | 124 | void skipFor(); |
124 | void skipBack(); | 125 | void skipBack(); |
125 | void stopSkip(); | 126 | void stopSkip(); |
126 | private: | 127 | private: |
127 | void toggleButton( int ); | 128 | void toggleButton( int ); |
128 | void setToggleButton( int, bool ); | 129 | void setToggleButton( int, bool ); |
129 | void paintButton( QPainter *p, int i ); | 130 | void paintButton( QPainter *p, int i ); |
130 | int skipDirection; | 131 | int skipDirection; |
131 | QString skin; | 132 | QString skin; |
132 | QPixmap *pixBg; | 133 | QPixmap *pixBg; |
133 | QImage *imgUp; | 134 | QImage *imgUp; |
134 | QImage *imgDn; | 135 | QImage *imgDn; |
135 | QImage *imgButtonMask; | 136 | QImage *imgButtonMask; |
136 | QBitmap *masks[10]; | 137 | QBitmap *masks[10]; |
137 | QPixmap *buttonPixUp[10]; | 138 | QPixmap *buttonPixUp[10]; |
138 | QPixmap *buttonPixDown[10]; | 139 | QPixmap *buttonPixDown[10]; |
139 | 140 | ||
140 | QPixmap *pixmaps[4]; | 141 | QPixmap *pixmaps[4]; |
141 | Ticker songInfo; | 142 | Ticker songInfo; |
142 | QSlider slider; | 143 | QSlider slider; |
143 | QLineEdit time; | 144 | QLineEdit time; |
144 | int xoff, yoff; | 145 | int xoff, yoff; |
145 | bool isStreaming : 1; | 146 | bool isStreaming : 1; |
146 | }; | 147 | }; |
147 | 148 | ||
148 | 149 | ||
149 | #endif // AUDIO_WIDGET_H | 150 | #endif // AUDIO_WIDGET_H |
150 | 151 | ||
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index f0a01a1..8b0f501 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -176,189 +176,189 @@ void MediaPlayer::next() { | |||
176 | mediaPlayerState->setView('l'); | 176 | mediaPlayerState->setView('l'); |
177 | if(l) mediaPlayerState->setLooping(l); | 177 | if(l) mediaPlayerState->setLooping(l); |
178 | if(r) mediaPlayerState->setShuffled(r); | 178 | if(r) mediaPlayerState->setShuffled(r); |
179 | } | 179 | } |
180 | qApp->processEvents(); | 180 | qApp->processEvents(); |
181 | } | 181 | } |
182 | 182 | ||
183 | 183 | ||
184 | void MediaPlayer::startDecreasingVolume() { | 184 | void MediaPlayer::startDecreasingVolume() { |
185 | volumeDirection = -1; | 185 | volumeDirection = -1; |
186 | startTimer( 100 ); | 186 | startTimer( 100 ); |
187 | volControl->decVol(2); | 187 | volControl->decVol(2); |
188 | } | 188 | } |
189 | 189 | ||
190 | 190 | ||
191 | void MediaPlayer::startIncreasingVolume() { | 191 | void MediaPlayer::startIncreasingVolume() { |
192 | volumeDirection = +1; | 192 | volumeDirection = +1; |
193 | startTimer( 100 ); | 193 | startTimer( 100 ); |
194 | volControl->incVol(2); | 194 | volControl->incVol(2); |
195 | } | 195 | } |
196 | 196 | ||
197 | 197 | ||
198 | bool drawnOnScreenDisplay = FALSE; | 198 | bool drawnOnScreenDisplay = FALSE; |
199 | unsigned int onScreenDisplayVolume = 0; | 199 | unsigned int onScreenDisplayVolume = 0; |
200 | const int yoff = 110; | 200 | const int yoff = 110; |
201 | 201 | ||
202 | void MediaPlayer::stopChangingVolume() { | 202 | void MediaPlayer::stopChangingVolume() { |
203 | killTimers(); | 203 | killTimers(); |
204 | // Get rid of the on-screen display stuff | 204 | // Get rid of the on-screen display stuff |
205 | drawnOnScreenDisplay = FALSE; | 205 | drawnOnScreenDisplay = FALSE; |
206 | onScreenDisplayVolume = 0; | 206 | onScreenDisplayVolume = 0; |
207 | int w=0; | 207 | int w=0; |
208 | int h=0; | 208 | int h=0; |
209 | if( !xineControl->hasVideo() ) { | 209 | if( !xineControl->hasVideo() ) { |
210 | w = audioUI->width(); | 210 | w = audioUI->width(); |
211 | h = audioUI->height(); | 211 | h = audioUI->height(); |
212 | audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); | 212 | audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); |
213 | } else { | 213 | } else { |
214 | w = videoUI->width(); | 214 | w = videoUI->width(); |
215 | h = videoUI->height(); | 215 | h = videoUI->height(); |
216 | videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); | 216 | videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); |
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | 220 | ||
221 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 221 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
222 | if ( volumeDirection == +1 ) { | 222 | if ( volumeDirection == +1 ) { |
223 | volControl->incVol( 2 ); | 223 | volControl->incVol( 2 ); |
224 | } else if ( volumeDirection == -1 ) { | 224 | } else if ( volumeDirection == -1 ) { |
225 | volControl->decVol( 2 ); | 225 | volControl->decVol( 2 ); |
226 | } | 226 | } |
227 | 227 | ||
228 | 228 | ||
229 | // TODO FIXME | 229 | // TODO FIXME |
230 | // huh?? | 230 | // huh?? |
231 | unsigned int v= 0; | 231 | unsigned int v= 0; |
232 | v = volControl->volume(); | 232 | v = volControl->volume(); |
233 | v = v / 10; | 233 | v = v / 10; |
234 | 234 | ||
235 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { | 235 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { |
236 | return; | 236 | return; |
237 | } | 237 | } |
238 | 238 | ||
239 | int w=0; int h=0; | 239 | int w=0; int h=0; |
240 | if( !xineControl->hasVideo() ) { | 240 | if( !xineControl->hasVideo() ) { |
241 | w = audioUI->width(); | 241 | w = audioUI->width(); |
242 | h = audioUI->height(); | 242 | h = audioUI->height(); |
243 | 243 | ||
244 | if ( drawnOnScreenDisplay ) { | 244 | if ( drawnOnScreenDisplay ) { |
245 | if ( onScreenDisplayVolume > v ) { | 245 | if ( onScreenDisplayVolume > v ) { |
246 | audioUI->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); | 246 | audioUI->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); |
247 | } | 247 | } |
248 | } | 248 | } |
249 | drawnOnScreenDisplay = TRUE; | 249 | drawnOnScreenDisplay = TRUE; |
250 | onScreenDisplayVolume = v; | 250 | onScreenDisplayVolume = v; |
251 | QPainter p( audioUI ); | 251 | QPainter p( audioUI ); |
252 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 252 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
253 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 253 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
254 | 254 | ||
255 | QFont f; | 255 | QFont f; |
256 | f.setPixelSize( 20 ); | 256 | f.setPixelSize( 20 ); |
257 | f.setBold( TRUE ); | 257 | f.setBold( TRUE ); |
258 | p.setFont( f ); | 258 | p.setFont( f ); |
259 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 259 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
260 | 260 | ||
261 | for ( unsigned int i = 0; i < 10; i++ ) { | 261 | for ( unsigned int i = 0; i < 10; i++ ) { |
262 | if ( v > i ) { | 262 | if ( v > i ) { |
263 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 263 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
264 | } else { | 264 | } else { |
265 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 265 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
266 | } | 266 | } |
267 | } | 267 | } |
268 | } else { | 268 | } else { |
269 | w = videoUI->width(); | 269 | w = videoUI->width(); |
270 | h = videoUI->height(); | 270 | h = videoUI->height(); |
271 | 271 | ||
272 | if ( drawnOnScreenDisplay ) { | 272 | if ( drawnOnScreenDisplay ) { |
273 | if ( onScreenDisplayVolume > v ) { | 273 | if ( onScreenDisplayVolume > v ) { |
274 | videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); | 274 | videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); |
275 | } | 275 | } |
276 | } | 276 | } |
277 | drawnOnScreenDisplay = TRUE; | 277 | drawnOnScreenDisplay = TRUE; |
278 | onScreenDisplayVolume = v; | 278 | onScreenDisplayVolume = v; |
279 | QPainter p( videoUI ); | 279 | QPainter p( videoUI ); |
280 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 280 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
281 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 281 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
282 | 282 | ||
283 | QFont f; | 283 | QFont f; |
284 | f.setPixelSize( 20 ); | 284 | f.setPixelSize( 20 ); |
285 | f.setBold( TRUE ); | 285 | f.setBold( TRUE ); |
286 | p.setFont( f ); | 286 | p.setFont( f ); |
287 | p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); | 287 | p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); |
288 | 288 | ||
289 | for ( unsigned int i = 0; i < 10; i++ ) { | 289 | for ( unsigned int i = 0; i < 10; i++ ) { |
290 | if ( v > i ) { | 290 | if ( v > i ) { |
291 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 291 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
292 | } else { | 292 | } else { |
293 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 293 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
294 | } | 294 | } |
295 | } | 295 | } |
296 | } | 296 | } |
297 | } | 297 | } |
298 | 298 | ||
299 | 299 | ||
300 | void MediaPlayer::blank( bool b ) { | 300 | void MediaPlayer::blank( bool b ) { |
301 | fd=open("/dev/fb0",O_RDWR); | 301 | fd=open("/dev/fb0",O_RDWR); |
302 | #ifdef QT_QWS_EBX | 302 | #ifdef QT_QWS_EBX |
303 | fl= open( "/dev/fl", O_RDWR ); | 303 | fl= open( "/dev/fl", O_RDWR ); |
304 | #endif | 304 | #endif |
305 | if (fd != -1) { | 305 | if (fd != -1) { |
306 | if ( b ) { | 306 | if ( b ) { |
307 | qDebug("do blanking"); | 307 | qDebug("do blanking"); |
308 | #ifdef QT_QWS_EBX | 308 | #ifdef QT_QWS_EBX |
309 | ioctl( fd, FBIOBLANK, 1 ); | 309 | ioctl( fd, FBIOBLANK, 1 ); |
310 | if(fl !=-1) { | 310 | if(fl !=-1) { |
311 | ioctl( fl, 2 ); | 311 | ioctl( fl, 2 ); |
312 | ::close(fl); | 312 | ::close(fl); |
313 | } | 313 | } |
314 | #else | 314 | #else |
315 | ioctl( fd, FBIOBLANK, 3 ); | 315 | ioctl( fd, FBIOBLANK, 3 ); |
316 | #endif | 316 | #endif |
317 | isBlanked = TRUE; | 317 | isBlanked = TRUE; |
318 | } else { | 318 | } else { |
319 | qDebug("do unblanking"); | 319 | qDebug("do unblanking"); |
320 | ioctl( fd, FBIOBLANK, 0); | 320 | ioctl( fd, FBIOBLANK, 0); |
321 | #ifdef QT_QWS_EBX | 321 | #ifdef QT_QWS_EBX |
322 | if(fl != -1) { | 322 | if(fl != -1) { |
323 | ioctl( fl, 1); | 323 | ioctl( fl, 1); |
324 | ::close(fl); | 324 | ::close(fl); |
325 | } | 325 | } |
326 | #endif | 326 | #endif |
327 | isBlanked = FALSE; | 327 | isBlanked = FALSE; |
328 | } | 328 | } |
329 | close( fd ); | 329 | close( fd ); |
330 | } else { | 330 | } else { |
331 | qDebug("<< /dev/fb0 could not be opened >>"); | 331 | qDebug("<< /dev/fb0 could not be opened >>"); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | 334 | ||
335 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | 335 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { |
336 | switch ( e->key() ) { | 336 | switch ( e->key() ) { |
337 | ////////////////////////////// Zaurus keys | 337 | ////////////////////////////// Zaurus keys |
338 | case Key_Home: | 338 | case Key_Home: |
339 | break; | 339 | break; |
340 | case Key_F9: //activity | 340 | case Key_F9: //activity |
341 | break; | 341 | break; |
342 | case Key_F10: //contacts | 342 | case Key_F10: //contacts |
343 | break; | 343 | break; |
344 | case Key_F11: //menu | 344 | case Key_F11: //menu |
345 | break; | 345 | break; |
346 | case Key_F12: //home | 346 | case Key_F12: //home |
347 | qDebug("Blank here"); | 347 | qDebug("Blank here"); |
348 | // mediaPlayerState->toggleBlank(); | 348 | // mediaPlayerState->toggleBlank(); |
349 | break; | 349 | break; |
350 | case Key_F13: //mail | 350 | case Key_F13: //mail |
351 | qDebug("Blank here"); | 351 | qDebug("Blank here"); |
352 | // mediaPlayerState->toggleBlank(); | 352 | // mediaPlayerState->toggleBlank(); |
353 | break; | 353 | break; |
354 | } | 354 | } |
355 | } | 355 | } |
356 | 356 | ||
357 | void MediaPlayer::cleanUp() {// this happens on closing | 357 | void MediaPlayer::cleanUp() {// this happens on closing |
358 | Config cfg( "OpiePlayer" ); | 358 | Config cfg( "OpiePlayer" ); |
359 | mediaPlayerState->writeConfig( cfg ); | 359 | mediaPlayerState->writeConfig( cfg ); |
360 | playList->writeDefaultPlaylist( ); | 360 | playList->writeDefaultPlaylist( ); |
361 | 361 | ||
362 | // QPEApplication::grabKeyboard(); | 362 | // QPEApplication::grabKeyboard(); |
363 | // QPEApplication::ungrabKeyboard(); | 363 | // QPEApplication::ungrabKeyboard(); |
364 | } | 364 | } |
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index 4ec5989..0b33dfd 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp | |||
@@ -1,279 +1,293 @@ | |||
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 | ..}^=.= = ; General Public License for more | 22 | ..}^=.= = ; 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 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = 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 | // this file is based on work by trolltech | 34 | // this file is based on work by trolltech |
35 | 35 | ||
36 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
37 | #include <qpe/qlibrary.h> | 37 | #include <qpe/qlibrary.h> |
38 | #include <qpe/config.h> | 38 | #include <qpe/config.h> |
39 | #include <qvaluelist.h> | 39 | #include <qvaluelist.h> |
40 | #include <qobject.h> | 40 | #include <qobject.h> |
41 | #include <qdir.h> | 41 | #include <qdir.h> |
42 | #include "mediaplayerstate.h" | 42 | #include "mediaplayerstate.h" |
43 | 43 | ||
44 | 44 | ||
45 | 45 | ||
46 | //#define MediaPlayerDebug(x) qDebug x | 46 | //#define MediaPlayerDebug(x) qDebug x |
47 | #define MediaPlayerDebug(x) | 47 | #define MediaPlayerDebug(x) |
48 | 48 | ||
49 | 49 | ||
50 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) | 50 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) |
51 | : QObject( parent, name ) { | 51 | : QObject( parent, name ) { |
52 | Config cfg( "OpiePlayer" ); | 52 | Config cfg( "OpiePlayer" ); |
53 | readConfig( cfg ); | 53 | readConfig( cfg ); |
54 | isStreaming = false; | 54 | isStreaming = false; |
55 | isSeekable = true; | ||
55 | } | 56 | } |
56 | 57 | ||
57 | 58 | ||
58 | MediaPlayerState::~MediaPlayerState() { | 59 | MediaPlayerState::~MediaPlayerState() { |
59 | } | 60 | } |
60 | 61 | ||
61 | 62 | ||
62 | void MediaPlayerState::readConfig( Config& cfg ) { | 63 | void MediaPlayerState::readConfig( Config& cfg ) { |
63 | cfg.setGroup("Options"); | 64 | cfg.setGroup("Options"); |
64 | isFullscreen = cfg.readBoolEntry( "FullScreen" ); | 65 | isFullscreen = cfg.readBoolEntry( "FullScreen" ); |
65 | isScaled = cfg.readBoolEntry( "Scaling" ); | 66 | isScaled = cfg.readBoolEntry( "Scaling" ); |
66 | isLooping = cfg.readBoolEntry( "Looping" ); | 67 | isLooping = cfg.readBoolEntry( "Looping" ); |
67 | isShuffled = cfg.readBoolEntry( "Shuffle" ); | 68 | isShuffled = cfg.readBoolEntry( "Shuffle" ); |
68 | usePlaylist = cfg.readBoolEntry( "UsePlayList" ); | 69 | usePlaylist = cfg.readBoolEntry( "UsePlayList" ); |
69 | videoGamma = cfg.readNumEntry( "VideoGamma" ); | 70 | videoGamma = cfg.readNumEntry( "VideoGamma" ); |
70 | usePlaylist = TRUE; | 71 | usePlaylist = TRUE; |
71 | isPlaying = FALSE; | 72 | isPlaying = FALSE; |
72 | isStreaming = FALSE; | 73 | isStreaming = FALSE; |
73 | isPaused = FALSE; | 74 | isPaused = FALSE; |
74 | curPosition = 0; | 75 | curPosition = 0; |
75 | curLength = 0; | 76 | curLength = 0; |
76 | curView = 'l'; | 77 | curView = 'l'; |
77 | } | 78 | } |
78 | 79 | ||
79 | 80 | ||
80 | void MediaPlayerState::writeConfig( Config& cfg ) const { | 81 | void MediaPlayerState::writeConfig( Config& cfg ) const { |
81 | cfg.setGroup( "Options" ); | 82 | cfg.setGroup( "Options" ); |
82 | cfg.writeEntry( "FullScreen", isFullscreen ); | 83 | cfg.writeEntry( "FullScreen", isFullscreen ); |
83 | cfg.writeEntry( "Scaling", isScaled ); | 84 | cfg.writeEntry( "Scaling", isScaled ); |
84 | cfg.writeEntry( "Looping", isLooping ); | 85 | cfg.writeEntry( "Looping", isLooping ); |
85 | cfg.writeEntry( "Shuffle", isShuffled ); | 86 | cfg.writeEntry( "Shuffle", isShuffled ); |
86 | cfg.writeEntry( "UsePlayList", usePlaylist ); | 87 | cfg.writeEntry( "UsePlayList", usePlaylist ); |
87 | cfg.writeEntry( "VideoGamma", videoGamma ); | 88 | cfg.writeEntry( "VideoGamma", videoGamma ); |
88 | } | 89 | } |
89 | 90 | ||
90 | 91 | ||
91 | // public stuff | 92 | // public stuff |
92 | 93 | ||
93 | 94 | ||
94 | bool MediaPlayerState::streaming() { | 95 | bool MediaPlayerState::streaming() { |
95 | return isStreaming; | 96 | return isStreaming; |
96 | } | 97 | } |
97 | 98 | ||
99 | bool MediaPlayerState::seekable() { | ||
100 | return isSeekable; | ||
101 | } | ||
102 | |||
98 | bool MediaPlayerState::fullscreen() { | 103 | bool MediaPlayerState::fullscreen() { |
99 | return isFullscreen; | 104 | return isFullscreen; |
100 | } | 105 | } |
101 | 106 | ||
102 | bool MediaPlayerState::scaled() { | 107 | bool MediaPlayerState::scaled() { |
103 | return isScaled; | 108 | return isScaled; |
104 | } | 109 | } |
105 | 110 | ||
106 | bool MediaPlayerState::looping() { | 111 | bool MediaPlayerState::looping() { |
107 | return isLooping; | 112 | return isLooping; |
108 | } | 113 | } |
109 | 114 | ||
110 | bool MediaPlayerState::shuffled() { | 115 | bool MediaPlayerState::shuffled() { |
111 | return isShuffled; | 116 | return isShuffled; |
112 | } | 117 | } |
113 | 118 | ||
114 | 119 | ||
115 | bool MediaPlayerState:: playlist() { | 120 | bool MediaPlayerState::playlist() { |
116 | return usePlaylist; | 121 | return usePlaylist; |
117 | } | 122 | } |
118 | 123 | ||
119 | bool MediaPlayerState::paused() { | 124 | bool MediaPlayerState::paused() { |
120 | return isPaused; | 125 | return isPaused; |
121 | } | 126 | } |
122 | 127 | ||
123 | bool MediaPlayerState::playing() { | 128 | bool MediaPlayerState::playing() { |
124 | return isPlaying; | 129 | return isPlaying; |
125 | } | 130 | } |
126 | 131 | ||
127 | bool MediaPlayerState::stop() { | 132 | bool MediaPlayerState::stop() { |
128 | return isStoped; | 133 | return isStoped; |
129 | } | 134 | } |
130 | 135 | ||
131 | long MediaPlayerState::position() { | 136 | long MediaPlayerState::position() { |
132 | return curPosition; | 137 | return curPosition; |
133 | } | 138 | } |
134 | 139 | ||
135 | long MediaPlayerState::length() { | 140 | long MediaPlayerState::length() { |
136 | return curLength; | 141 | return curLength; |
137 | } | 142 | } |
138 | 143 | ||
139 | char MediaPlayerState::view() { | 144 | char MediaPlayerState::view() { |
140 | return curView; | 145 | return curView; |
141 | } | 146 | } |
142 | 147 | ||
143 | // slots | 148 | // slots |
144 | void MediaPlayerState::setIsStreaming( bool b ) { | 149 | void MediaPlayerState::setIsStreaming( bool b ) { |
145 | 150 | ||
146 | if ( isStreaming == b ) { | 151 | if ( isStreaming == b ) { |
147 | return; | 152 | return; |
148 | } | 153 | } |
149 | isStreaming = b; | 154 | isStreaming = b; |
150 | } | 155 | } |
151 | 156 | ||
157 | void MediaPlayerState::setIsSeekable( bool b ) { | ||
158 | |||
159 | //if ( isSeekable == b ) { | ||
160 | // return; | ||
161 | // } | ||
162 | isSeekable = b; | ||
163 | emit isSeekableToggled(b); | ||
164 | } | ||
165 | |||
152 | 166 | ||
153 | void MediaPlayerState::setFullscreen( bool b ) { | 167 | void MediaPlayerState::setFullscreen( bool b ) { |
154 | if ( isFullscreen == b ) { | 168 | if ( isFullscreen == b ) { |
155 | return; | 169 | return; |
156 | } | 170 | } |
157 | isFullscreen = b; | 171 | isFullscreen = b; |
158 | emit fullscreenToggled(b); | 172 | emit fullscreenToggled(b); |
159 | } | 173 | } |
160 | 174 | ||
161 | 175 | ||
162 | void MediaPlayerState::setBlanked( bool b ) { | 176 | void MediaPlayerState::setBlanked( bool b ) { |
163 | if ( isBlanked == b ) { | 177 | if ( isBlanked == b ) { |
164 | return; | 178 | return; |
165 | } | 179 | } |
166 | isBlanked = b; | 180 | isBlanked = b; |
167 | emit blankToggled(b); | 181 | emit blankToggled(b); |
168 | } | 182 | } |
169 | 183 | ||
170 | 184 | ||
171 | void MediaPlayerState::setScaled( bool b ) { | 185 | void MediaPlayerState::setScaled( bool b ) { |
172 | if ( isScaled == b ) { | 186 | if ( isScaled == b ) { |
173 | return; | 187 | return; |
174 | } | 188 | } |
175 | isScaled = b; | 189 | isScaled = b; |
176 | emit scaledToggled(b); | 190 | emit scaledToggled(b); |
177 | } | 191 | } |
178 | 192 | ||
179 | void MediaPlayerState::setLooping( bool b ) { | 193 | void MediaPlayerState::setLooping( bool b ) { |
180 | if ( isLooping == b ) { | 194 | if ( isLooping == b ) { |
181 | return; | 195 | return; |
182 | } | 196 | } |
183 | isLooping = b; | 197 | isLooping = b; |
184 | emit loopingToggled(b); | 198 | emit loopingToggled(b); |
185 | } | 199 | } |
186 | 200 | ||
187 | void MediaPlayerState::setShuffled( bool b ) { | 201 | void MediaPlayerState::setShuffled( bool b ) { |
188 | if ( isShuffled == b ) { | 202 | if ( isShuffled == b ) { |
189 | return; | 203 | return; |
190 | } | 204 | } |
191 | isShuffled = b; | 205 | isShuffled = b; |
192 | emit shuffledToggled(b); | 206 | emit shuffledToggled(b); |
193 | } | 207 | } |
194 | 208 | ||
195 | void MediaPlayerState::setPlaylist( bool b ) { | 209 | void MediaPlayerState::setPlaylist( bool b ) { |
196 | if ( usePlaylist == b ) { | 210 | if ( usePlaylist == b ) { |
197 | return; | 211 | return; |
198 | } | 212 | } |
199 | usePlaylist = b; | 213 | usePlaylist = b; |
200 | emit playlistToggled(b); | 214 | emit playlistToggled(b); |
201 | } | 215 | } |
202 | 216 | ||
203 | void MediaPlayerState::setPaused( bool b ) { | 217 | void MediaPlayerState::setPaused( bool b ) { |
204 | if ( isPaused == b ) { | 218 | if ( isPaused == b ) { |
205 | isPaused = FALSE; | 219 | isPaused = FALSE; |
206 | emit pausedToggled(FALSE); | 220 | emit pausedToggled(FALSE); |
207 | return; | 221 | return; |
208 | } | 222 | } |
209 | isPaused = b; | 223 | isPaused = b; |
210 | emit pausedToggled(b); | 224 | emit pausedToggled(b); |
211 | } | 225 | } |
212 | 226 | ||
213 | void MediaPlayerState::setPlaying( bool b ) { | 227 | void MediaPlayerState::setPlaying( bool b ) { |
214 | if ( isPlaying == b ) { | 228 | if ( isPlaying == b ) { |
215 | return; | 229 | return; |
216 | } | 230 | } |
217 | isPlaying = b; | 231 | isPlaying = b; |
218 | isStoped = !b; | 232 | isStoped = !b; |
219 | emit playingToggled(b); | 233 | emit playingToggled(b); |
220 | } | 234 | } |
221 | 235 | ||
222 | void MediaPlayerState::setStop( bool b ) { | 236 | void MediaPlayerState::setStop( bool b ) { |
223 | if ( isStoped == b ) { | 237 | if ( isStoped == b ) { |
224 | return; | 238 | return; |
225 | } | 239 | } |
226 | isStoped = b; | 240 | isStoped = b; |
227 | emit stopToggled(b); | 241 | emit stopToggled(b); |
228 | } | 242 | } |
229 | 243 | ||
230 | void MediaPlayerState::setPosition( long p ) { | 244 | void MediaPlayerState::setPosition( long p ) { |
231 | if ( curPosition == p ) { | 245 | if ( curPosition == p ) { |
232 | return; | 246 | return; |
233 | } | 247 | } |
234 | curPosition = p; | 248 | curPosition = p; |
235 | emit positionChanged(p); | 249 | emit positionChanged(p); |
236 | } | 250 | } |
237 | 251 | ||
238 | void MediaPlayerState::updatePosition( long p ){ | 252 | void MediaPlayerState::updatePosition( long p ){ |
239 | if ( curPosition == p ) { | 253 | if ( curPosition == p ) { |
240 | return; | 254 | return; |
241 | } | 255 | } |
242 | curPosition = p; | 256 | curPosition = p; |
243 | emit positionUpdated(p); | 257 | emit positionUpdated(p); |
244 | } | 258 | } |
245 | 259 | ||
246 | void MediaPlayerState::setVideoGamma( int v ){ | 260 | void MediaPlayerState::setVideoGamma( int v ){ |
247 | if ( videoGamma == v ) { | 261 | if ( videoGamma == v ) { |
248 | return; | 262 | return; |
249 | } | 263 | } |
250 | videoGamma = v; | 264 | videoGamma = v; |
251 | emit videoGammaChanged( v ); | 265 | emit videoGammaChanged( v ); |
252 | } | 266 | } |
253 | 267 | ||
254 | void MediaPlayerState::setLength( long l ) { | 268 | void MediaPlayerState::setLength( long l ) { |
255 | if ( curLength == l ) { | 269 | if ( curLength == l ) { |
256 | return; | 270 | return; |
257 | } | 271 | } |
258 | curLength = l; | 272 | curLength = l; |
259 | emit lengthChanged(l); | 273 | emit lengthChanged(l); |
260 | } | 274 | } |
261 | 275 | ||
262 | void MediaPlayerState::setView( char v ) { | 276 | void MediaPlayerState::setView( char v ) { |
263 | if ( curView == v ) { | 277 | if ( curView == v ) { |
264 | return; | 278 | return; |
265 | } | 279 | } |
266 | curView = v; | 280 | curView = v; |
267 | emit viewChanged(v); | 281 | emit viewChanged(v); |
268 | } | 282 | } |
269 | 283 | ||
270 | void MediaPlayerState::setPrev(){ | 284 | void MediaPlayerState::setPrev(){ |
271 | emit prev(); | 285 | emit prev(); |
272 | } | 286 | } |
273 | 287 | ||
274 | void MediaPlayerState::setNext() { | 288 | void MediaPlayerState::setNext() { |
275 | emit next(); | 289 | emit next(); |
276 | } | 290 | } |
277 | 291 | ||
278 | void MediaPlayerState::setList() { | 292 | void MediaPlayerState::setList() { |
279 | setPlaying( FALSE ); | 293 | setPlaying( FALSE ); |
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index 4fef8e0..8c4e09e 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h | |||
@@ -1,139 +1,143 @@ | |||
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 | ..}^=.= = ; General Public License for more | 22 | ..}^=.= = ; 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 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = 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 | // this file is based on work by trolltech | 34 | // this file is based on work by trolltech |
35 | 35 | ||
36 | #ifndef MEDIA_PLAYER_STATE_H | 36 | #ifndef MEDIA_PLAYER_STATE_H |
37 | #define MEDIA_PLAYER_STATE_H | 37 | #define MEDIA_PLAYER_STATE_H |
38 | 38 | ||
39 | 39 | ||
40 | #include <qobject.h> | 40 | #include <qobject.h> |
41 | 41 | ||
42 | 42 | ||
43 | class MediaPlayerDecoder; | 43 | class MediaPlayerDecoder; |
44 | class Config; | 44 | class Config; |
45 | 45 | ||
46 | 46 | ||
47 | class MediaPlayerState : public QObject { | 47 | class MediaPlayerState : public QObject { |
48 | Q_OBJECT | 48 | Q_OBJECT |
49 | public: | 49 | public: |
50 | MediaPlayerState( QObject *parent, const char *name ); | 50 | MediaPlayerState( QObject *parent, const char *name ); |
51 | ~MediaPlayerState(); | 51 | ~MediaPlayerState(); |
52 | 52 | ||
53 | bool isPaused; | 53 | bool isPaused; |
54 | bool isPlaying; | 54 | bool isPlaying; |
55 | bool isStoped; | 55 | bool isStoped; |
56 | bool streaming(); | 56 | bool streaming(); |
57 | bool seekable(); | ||
57 | bool fullscreen(); | 58 | bool fullscreen(); |
58 | bool scaled(); | 59 | bool scaled(); |
59 | bool looping(); | 60 | bool looping(); |
60 | bool shuffled(); | 61 | bool shuffled(); |
61 | bool playlist(); | 62 | bool playlist(); |
62 | bool paused(); | 63 | bool paused(); |
63 | bool playing(); | 64 | bool playing(); |
64 | bool stop(); | 65 | bool stop(); |
65 | long position(); | 66 | long position(); |
66 | long length(); | 67 | long length(); |
67 | char view(); | 68 | char view(); |
68 | 69 | ||
69 | public slots: | 70 | public slots: |
70 | void setIsStreaming( bool b ); | 71 | void setIsStreaming( bool b ); |
72 | void setIsSeekable( bool b ); | ||
71 | void setFullscreen( bool b ); | 73 | void setFullscreen( bool b ); |
72 | void setScaled( bool b ); | 74 | void setScaled( bool b ); |
73 | void setLooping( bool b ); | 75 | void setLooping( bool b ); |
74 | void setShuffled( bool b ); | 76 | void setShuffled( bool b ); |
75 | void setPlaylist( bool b ); | 77 | void setPlaylist( bool b ); |
76 | void setPaused( bool b ); | 78 | void setPaused( bool b ); |
77 | void setPlaying( bool b ); | 79 | void setPlaying( bool b ); |
78 | void setStop( bool b ); | 80 | void setStop( bool b ); |
79 | void setPosition( long p ); | 81 | void setPosition( long p ); |
80 | void updatePosition( long p ); | 82 | void updatePosition( long p ); |
81 | void setLength( long l ); | 83 | void setLength( long l ); |
82 | void setView( char v ); | 84 | void setView( char v ); |
83 | void setBlanked( bool b ); | 85 | void setBlanked( bool b ); |
84 | void setVideoGamma( int v ); | 86 | void setVideoGamma( int v ); |
85 | 87 | ||
86 | void setPrev(); | 88 | void setPrev(); |
87 | void setNext(); | 89 | void setNext(); |
88 | void setList(); | 90 | void setList(); |
89 | void setVideo(); | 91 | void setVideo(); |
90 | void setAudio(); | 92 | void setAudio(); |
91 | 93 | ||
92 | void toggleFullscreen(); | 94 | void toggleFullscreen(); |
93 | void toggleScaled(); | 95 | void toggleScaled(); |
94 | void toggleLooping(); | 96 | void toggleLooping(); |
95 | void toggleShuffled(); | 97 | void toggleShuffled(); |
96 | void togglePlaylist(); | 98 | void togglePlaylist(); |
97 | void togglePaused(); | 99 | void togglePaused(); |
98 | void togglePlaying(); | 100 | void togglePlaying(); |
99 | void toggleBlank(); | 101 | void toggleBlank(); |
100 | void writeConfig( Config& cfg ) const; | 102 | void writeConfig( Config& cfg ) const; |
101 | 103 | ||
102 | 104 | ||
103 | signals: | 105 | signals: |
104 | void fullscreenToggled( bool ); | 106 | void fullscreenToggled( bool ); |
105 | void scaledToggled( bool ); | 107 | void scaledToggled( bool ); |
106 | void loopingToggled( bool ); | 108 | void loopingToggled( bool ); |
107 | void shuffledToggled( bool ); | 109 | void shuffledToggled( bool ); |
108 | void playlistToggled( bool ); | 110 | void playlistToggled( bool ); |
109 | void pausedToggled( bool ); | 111 | void pausedToggled( bool ); |
110 | void playingToggled( bool ); | 112 | void playingToggled( bool ); |
111 | void stopToggled( bool ); | 113 | void stopToggled( bool ); |
112 | void positionChanged( long ); // When the slider is moved | 114 | void positionChanged( long ); // When the slider is moved |
113 | void positionUpdated( long ); // When the media file progresses | 115 | void positionUpdated( long ); // When the media file progresses |
114 | void lengthChanged( long ); | 116 | void lengthChanged( long ); |
115 | void viewChanged( char ); | 117 | void viewChanged( char ); |
118 | void isSeekableToggled( bool ); | ||
116 | void blankToggled( bool ); | 119 | void blankToggled( bool ); |
117 | void videoGammaChanged( int ); | 120 | void videoGammaChanged( int ); |
118 | void prev(); | 121 | void prev(); |
119 | void next(); | 122 | void next(); |
120 | 123 | ||
121 | private: | 124 | private: |
122 | bool isStreaming; | 125 | bool isStreaming; |
126 | bool isSeekable; | ||
123 | bool isFullscreen; | 127 | bool isFullscreen; |
124 | bool isScaled; | 128 | bool isScaled; |
125 | bool isBlanked; | 129 | bool isBlanked; |
126 | bool isLooping; | 130 | bool isLooping; |
127 | bool isShuffled; | 131 | bool isShuffled; |
128 | bool usePlaylist; | 132 | bool usePlaylist; |
129 | long curPosition; | 133 | long curPosition; |
130 | long curLength; | 134 | long curLength; |
131 | char curView; | 135 | char curView; |
132 | int videoGamma; | 136 | int videoGamma; |
133 | void readConfig( Config& cfg ); | 137 | void readConfig( Config& cfg ); |
134 | 138 | ||
135 | }; | 139 | }; |
136 | 140 | ||
137 | 141 | ||
138 | #endif // MEDIA_PLAYER_STATE_H | 142 | #endif // MEDIA_PLAYER_STATE_H |
139 | 143 | ||
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c index b1f4811..707efeb 100644 --- a/noncore/multimedia/opieplayer2/nullvideo.c +++ b/noncore/multimedia/opieplayer2/nullvideo.c | |||
@@ -372,239 +372,239 @@ static void null_overlay_clut_yuv2rgb (null_driver_t *this, | |||
372 | } | 372 | } |
373 | if (!overlay->clip_rgb_clut) { | 373 | if (!overlay->clip_rgb_clut) { |
374 | clut = (clut_t*) overlay->clip_color; | 374 | clut = (clut_t*) overlay->clip_color; |
375 | for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { | 375 | for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { |
376 | *((uint32_t *)&clut[i]) = | 376 | *((uint32_t *)&clut[i]) = |
377 | frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb, | 377 | frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb, |
378 | clut[i].y, clut[i].cb, clut[i].cr); | 378 | clut[i].y, clut[i].cb, clut[i].cr); |
379 | } | 379 | } |
380 | overlay->clip_rgb_clut++; | 380 | overlay->clip_rgb_clut++; |
381 | } | 381 | } |
382 | } | 382 | } |
383 | 383 | ||
384 | static void null_overlay_blend ( xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { | 384 | static void null_overlay_blend ( xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { |
385 | null_driver_t *this = (null_driver_t *) this_gen; | 385 | null_driver_t *this = (null_driver_t *) this_gen; |
386 | opie_frame_t *frame = (opie_frame_t *) frame_gen; | 386 | opie_frame_t *frame = (opie_frame_t *) frame_gen; |
387 | 387 | ||
388 | if(!this->m_show_video || frame->sc.output_width == 0 | 388 | if(!this->m_show_video || frame->sc.output_width == 0 |
389 | || frame->sc.output_height== 0) | 389 | || frame->sc.output_height== 0) |
390 | return; | 390 | return; |
391 | 391 | ||
392 | /* Alpha Blend here */ | 392 | /* Alpha Blend here */ |
393 | if (overlay->rle) { | 393 | if (overlay->rle) { |
394 | if( !overlay->rgb_clut || !overlay->clip_rgb_clut) | 394 | if( !overlay->rgb_clut || !overlay->clip_rgb_clut) |
395 | null_overlay_clut_yuv2rgb(this,overlay,frame); | 395 | null_overlay_clut_yuv2rgb(this,overlay,frame); |
396 | 396 | ||
397 | switch(this->bpp) { | 397 | switch(this->bpp) { |
398 | case 16: | 398 | case 16: |
399 | blend_rgb16( (uint8_t *)frame->data, overlay, | 399 | blend_rgb16( (uint8_t *)frame->data, overlay, |
400 | frame->sc.output_width, frame->sc.output_height, | 400 | frame->sc.output_width, frame->sc.output_height, |
401 | frame->sc.delivered_width, frame->sc.delivered_height); | 401 | frame->sc.delivered_width, frame->sc.delivered_height); |
402 | break; | 402 | break; |
403 | case 24: | 403 | case 24: |
404 | blend_rgb24( (uint8_t *)frame->data, overlay, | 404 | blend_rgb24( (uint8_t *)frame->data, overlay, |
405 | frame->sc.output_width, frame->sc.output_height, | 405 | frame->sc.output_width, frame->sc.output_height, |
406 | frame->sc.delivered_width, frame->sc.delivered_height); | 406 | frame->sc.delivered_width, frame->sc.delivered_height); |
407 | break; | 407 | break; |
408 | case 32: | 408 | case 32: |
409 | blend_rgb32( (uint8_t *)frame->data, overlay, | 409 | blend_rgb32( (uint8_t *)frame->data, overlay, |
410 | frame->sc.output_width, frame->sc.output_height, | 410 | frame->sc.output_width, frame->sc.output_height, |
411 | frame->sc.delivered_width, frame->sc.delivered_height); | 411 | frame->sc.delivered_width, frame->sc.delivered_height); |
412 | break; | 412 | break; |
413 | default: | 413 | default: |
414 | /* It should never get here */ | 414 | /* It should never get here */ |
415 | break; | 415 | break; |
416 | } | 416 | } |
417 | } | 417 | } |
418 | } | 418 | } |
419 | 419 | ||
420 | 420 | ||
421 | static int null_get_property( xine_vo_driver_t* self, | 421 | static int null_get_property( xine_vo_driver_t* self, |
422 | int property ){ | 422 | int property ){ |
423 | return 0; | 423 | return 0; |
424 | } | 424 | } |
425 | static int null_set_property( xine_vo_driver_t* self, | 425 | static int null_set_property( xine_vo_driver_t* self, |
426 | int property, | 426 | int property, |
427 | int value ){ | 427 | int value ){ |
428 | return value; | 428 | return value; |
429 | } | 429 | } |
430 | static void null_get_property_min_max( xine_vo_driver_t* self, | 430 | static void null_get_property_min_max( xine_vo_driver_t* self, |
431 | int property, int *min, | 431 | int property, int *min, |
432 | int *max ){ | 432 | int *max ){ |
433 | *max = 0; | 433 | *max = 0; |
434 | *min = 0; | 434 | *min = 0; |
435 | } | 435 | } |
436 | static int null_gui_data_exchange( xine_vo_driver_t* self, | 436 | static int null_gui_data_exchange( xine_vo_driver_t* self, |
437 | int data_type, | 437 | int data_type, |
438 | void *data ){ | 438 | void *data ){ |
439 | return 0; | 439 | return 0; |
440 | } | 440 | } |
441 | 441 | ||
442 | static void null_dispose ( xine_vo_driver_t* self ){ | 442 | static void null_dispose ( xine_vo_driver_t* self ){ |
443 | null_driver_t* this = (null_driver_t*)self; | 443 | null_driver_t* this = (null_driver_t*)self; |
444 | free ( this ); | 444 | free ( this ); |
445 | } | 445 | } |
446 | static int null_redraw_needed( xine_vo_driver_t* self ){ | 446 | static int null_redraw_needed( xine_vo_driver_t* self ){ |
447 | return 0; | 447 | return 0; |
448 | } | 448 | } |
449 | 449 | ||
450 | 450 | ||
451 | xine_vo_driver_t* init_video_out_plugin( config_values_t* conf, | 451 | xine_vo_driver_t* init_video_out_plugin( config_values_t* conf, |
452 | void* video ){ | 452 | void* video ){ |
453 | null_driver_t *vo; | 453 | null_driver_t *vo; |
454 | vo = (null_driver_t*)malloc( sizeof(null_driver_t ) ); | 454 | vo = (null_driver_t*)malloc( sizeof(null_driver_t ) ); |
455 | 455 | ||
456 | /* memset? */ | 456 | /* memset? */ |
457 | memset(vo,0, sizeof(null_driver_t ) ); | 457 | memset(vo,0, sizeof(null_driver_t ) ); |
458 | 458 | ||
459 | vo_scale_init (&vo->sc, 0, 0); | 459 | vo_scale_init (&vo->sc, 0, 0); |
460 | 460 | ||
461 | vo->sc.gui_pixel_aspect = 1.0; | 461 | vo->sc.gui_pixel_aspect = 1.0; |
462 | 462 | ||
463 | vo->m_show_video = 0; // false | 463 | vo->m_show_video = 0; // false |
464 | vo->m_video_fullscreen = 0; | 464 | vo->m_video_fullscreen = 0; |
465 | vo->m_is_scaling = 0; | 465 | vo->m_is_scaling = 0; |
466 | vo->display_ratio = 1.0; | 466 | vo->display_ratio = 1.0; |
467 | vo->gui_width = 16; | 467 | vo->gui_width = 16; |
468 | vo->gui_height = 8; | 468 | vo->gui_height = 8; |
469 | vo->frameDis = NULL; | 469 | vo->frameDis = NULL; |
470 | 470 | ||
471 | /* install callback handlers*/ | 471 | /* install callback handlers*/ |
472 | vo->vo_driver.get_capabilities = null_get_capabilities; | 472 | vo->vo_driver.get_capabilities = null_get_capabilities; |
473 | vo->vo_driver.alloc_frame = null_alloc_frame; | 473 | vo->vo_driver.alloc_frame = null_alloc_frame; |
474 | vo->vo_driver.update_frame_format = null_update_frame_format; | 474 | vo->vo_driver.update_frame_format = null_update_frame_format; |
475 | vo->vo_driver.display_frame = null_display_frame; | 475 | vo->vo_driver.display_frame = null_display_frame; |
476 | vo->vo_driver.overlay_blend = null_overlay_blend; | 476 | vo->vo_driver.overlay_blend = null_overlay_blend; |
477 | vo->vo_driver.get_property = null_get_property; | 477 | vo->vo_driver.get_property = null_get_property; |
478 | vo->vo_driver.set_property = null_set_property; | 478 | vo->vo_driver.set_property = null_set_property; |
479 | vo->vo_driver.get_property_min_max = null_get_property_min_max; | 479 | vo->vo_driver.get_property_min_max = null_get_property_min_max; |
480 | vo->vo_driver.gui_data_exchange = null_gui_data_exchange; | 480 | vo->vo_driver.gui_data_exchange = null_gui_data_exchange; |
481 | vo->vo_driver.dispose = null_dispose; | 481 | vo->vo_driver.dispose = null_dispose; |
482 | vo->vo_driver.redraw_needed = null_redraw_needed; | 482 | vo->vo_driver.redraw_needed = null_redraw_needed; |
483 | 483 | ||
484 | 484 | ||
485 | /* capabilities */ | 485 | /* capabilities */ |
486 | vo->m_capabilities = VO_CAP_COPIES_IMAGE | VO_CAP_YUY2 | VO_CAP_YV12; | 486 | vo->m_capabilities = VO_CAP_COPIES_IMAGE | VO_CAP_YUY2 | VO_CAP_YV12; |
487 | vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap, | 487 | vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap, |
488 | vo->yuv2rgb_cmap); | 488 | vo->yuv2rgb_cmap); |
489 | 489 | ||
490 | return ( xine_vo_driver_t*) vo; | 490 | return ( xine_vo_driver_t*) vo; |
491 | } | 491 | } |
492 | 492 | ||
493 | #if 0 | 493 | #if 0 |
494 | static vo_info_t vo_info_null = { | 494 | static vo_info_t vo_info_null = { |
495 | 5, | 495 | 5, |
496 | XINE_VISUAL_TYPE_FB | 496 | XINE_VISUAL_TYPE_FB |
497 | }; | 497 | }; |
498 | 498 | ||
499 | vo_info_t *get_video_out_plugin_info(){ | 499 | vo_info_t *get_video_out_plugin_info(){ |
500 | vo_info_null.description = _("xine video output plugin using null device"); | 500 | vo_info_null.description = ("xine video output plugin using null device"); |
501 | return &vo_info_null; | 501 | return &vo_info_null; |
502 | } | 502 | } |
503 | 503 | ||
504 | #endif | 504 | #endif |
505 | 505 | ||
506 | /* this is special for this device */ | 506 | /* this is special for this device */ |
507 | /** | 507 | /** |
508 | * We know that we will be controled by the XINE LIB++ | 508 | * We know that we will be controled by the XINE LIB++ |
509 | */ | 509 | */ |
510 | 510 | ||
511 | /** | 511 | /** |
512 | * | 512 | * |
513 | */ | 513 | */ |
514 | int null_is_showing_video( xine_vo_driver_t* self ){ | 514 | int null_is_showing_video( xine_vo_driver_t* self ){ |
515 | null_driver_t* this = (null_driver_t*)self; | 515 | null_driver_t* this = (null_driver_t*)self; |
516 | return this->m_show_video; | 516 | return this->m_show_video; |
517 | } | 517 | } |
518 | void null_set_show_video( xine_vo_driver_t* self, int show ) { | 518 | void null_set_show_video( xine_vo_driver_t* self, int show ) { |
519 | ((null_driver_t*)self)->m_show_video = show; | 519 | ((null_driver_t*)self)->m_show_video = show; |
520 | } | 520 | } |
521 | 521 | ||
522 | int null_is_fullscreen( xine_vo_driver_t* self ){ | 522 | int null_is_fullscreen( xine_vo_driver_t* self ){ |
523 | return ((null_driver_t*)self)->m_video_fullscreen; | 523 | return ((null_driver_t*)self)->m_video_fullscreen; |
524 | } | 524 | } |
525 | void null_set_fullscreen( xine_vo_driver_t* self, int screen ){ | 525 | void null_set_fullscreen( xine_vo_driver_t* self, int screen ){ |
526 | ((null_driver_t*)self)->m_video_fullscreen = screen; | 526 | ((null_driver_t*)self)->m_video_fullscreen = screen; |
527 | } | 527 | } |
528 | int null_is_scaling( xine_vo_driver_t* self ){ | 528 | int null_is_scaling( xine_vo_driver_t* self ){ |
529 | return ((null_driver_t*)self)->m_is_scaling; | 529 | return ((null_driver_t*)self)->m_is_scaling; |
530 | } | 530 | } |
531 | 531 | ||
532 | void null_set_videoGamma( xine_vo_driver_t* self , int value ) { | 532 | void null_set_videoGamma( xine_vo_driver_t* self , int value ) { |
533 | ((null_driver_t*) self) ->yuv2rgb_gamma = value; | 533 | ((null_driver_t*) self) ->yuv2rgb_gamma = value; |
534 | ((null_driver_t*) self) ->yuv2rgb_factory->set_gamma( ((null_driver_t*) self) ->yuv2rgb_factory, value ); | 534 | ((null_driver_t*) self) ->yuv2rgb_factory->set_gamma( ((null_driver_t*) self) ->yuv2rgb_factory, value ); |
535 | } | 535 | } |
536 | 536 | ||
537 | void null_set_scaling( xine_vo_driver_t* self, int scale ) { | 537 | void null_set_scaling( xine_vo_driver_t* self, int scale ) { |
538 | ((null_driver_t*)self)->m_is_scaling = scale; | 538 | ((null_driver_t*)self)->m_is_scaling = scale; |
539 | } | 539 | } |
540 | 540 | ||
541 | void null_set_gui_width( xine_vo_driver_t* self, int width ) { | 541 | void null_set_gui_width( xine_vo_driver_t* self, int width ) { |
542 | ((null_driver_t*)self)->gui_width = width; | 542 | ((null_driver_t*)self)->gui_width = width; |
543 | } | 543 | } |
544 | void null_set_gui_height( xine_vo_driver_t* self, int height ) { | 544 | void null_set_gui_height( xine_vo_driver_t* self, int height ) { |
545 | ((null_driver_t*)self)->gui_height = height; | 545 | ((null_driver_t*)self)->gui_height = height; |
546 | } | 546 | } |
547 | 547 | ||
548 | 548 | ||
549 | void null_set_mode( xine_vo_driver_t* self, int depth, int rgb ) { | 549 | void null_set_mode( xine_vo_driver_t* self, int depth, int rgb ) { |
550 | null_driver_t* this = (null_driver_t*)self; | 550 | null_driver_t* this = (null_driver_t*)self; |
551 | 551 | ||
552 | this->bytes_per_pixel = (depth + 7 ) / 8; | 552 | this->bytes_per_pixel = (depth + 7 ) / 8; |
553 | this->bpp = this->bytes_per_pixel * 8; | 553 | this->bpp = this->bytes_per_pixel * 8; |
554 | this->depth = depth; | 554 | this->depth = depth; |
555 | printf("depth %d %d\n", depth, this->bpp); | 555 | printf("depth %d %d\n", depth, this->bpp); |
556 | printf("pixeltype %d\n", rgb ); | 556 | printf("pixeltype %d\n", rgb ); |
557 | switch ( this->depth ) { | 557 | switch ( this->depth ) { |
558 | case 32: | 558 | case 32: |
559 | if( rgb == 0 ) | 559 | if( rgb == 0 ) |
560 | this->yuv2rgb_mode = MODE_32_RGB; | 560 | this->yuv2rgb_mode = MODE_32_RGB; |
561 | else | 561 | else |
562 | this->yuv2rgb_mode = MODE_32_BGR; | 562 | this->yuv2rgb_mode = MODE_32_BGR; |
563 | case 24: | 563 | case 24: |
564 | if( this->bpp == 32 ) { | 564 | if( this->bpp == 32 ) { |
565 | if( rgb == 0 ) { | 565 | if( rgb == 0 ) { |
566 | this->yuv2rgb_mode = MODE_32_RGB; | 566 | this->yuv2rgb_mode = MODE_32_RGB; |
567 | } else { | 567 | } else { |
568 | this->yuv2rgb_mode = MODE_32_BGR; | 568 | this->yuv2rgb_mode = MODE_32_BGR; |
569 | } | 569 | } |
570 | }else{ | 570 | }else{ |
571 | if( rgb == 0 ) | 571 | if( rgb == 0 ) |
572 | this->yuv2rgb_mode = MODE_24_RGB; | 572 | this->yuv2rgb_mode = MODE_24_RGB; |
573 | else | 573 | else |
574 | this->yuv2rgb_mode = MODE_24_BGR; | 574 | this->yuv2rgb_mode = MODE_24_BGR; |
575 | }; | 575 | }; |
576 | break; | 576 | break; |
577 | case 16: | 577 | case 16: |
578 | if( rgb == 0 ) { | 578 | if( rgb == 0 ) { |
579 | this->yuv2rgb_mode = MODE_16_RGB; | 579 | this->yuv2rgb_mode = MODE_16_RGB; |
580 | } else { | 580 | } else { |
581 | this->yuv2rgb_mode = MODE_16_BGR; | 581 | this->yuv2rgb_mode = MODE_16_BGR; |
582 | } | 582 | } |
583 | break; | 583 | break; |
584 | case 15: | 584 | case 15: |
585 | if( rgb == 0 ) { | 585 | if( rgb == 0 ) { |
586 | this->yuv2rgb_mode = MODE_15_RGB; | 586 | this->yuv2rgb_mode = MODE_15_RGB; |
587 | } else { | 587 | } else { |
588 | this->yuv2rgb_mode = MODE_15_BGR; | 588 | this->yuv2rgb_mode = MODE_15_BGR; |
589 | } | 589 | } |
590 | break; | 590 | break; |
591 | case 8: | 591 | case 8: |
592 | if( rgb == 0 ) { | 592 | if( rgb == 0 ) { |
593 | this->yuv2rgb_mode = MODE_8_RGB; | 593 | this->yuv2rgb_mode = MODE_8_RGB; |
594 | } else { | 594 | } else { |
595 | this->yuv2rgb_mode = MODE_8_BGR; | 595 | this->yuv2rgb_mode = MODE_8_BGR; |
596 | } | 596 | } |
597 | break; | 597 | break; |
598 | }; | 598 | }; |
599 | //free(this->yuv2rgb_factory ); | 599 | //free(this->yuv2rgb_factory ); |
600 | // this->yuv2rgb_factory = yuv2rgb_factory_init (this->yuv2rgb_mode, this->yuv2rgb_swap, | 600 | // this->yuv2rgb_factory = yuv2rgb_factory_init (this->yuv2rgb_mode, this->yuv2rgb_swap, |
601 | // this->yuv2rgb_cmap); | 601 | // this->yuv2rgb_cmap); |
602 | }; | 602 | }; |
603 | 603 | ||
604 | void null_display_handler( xine_vo_driver_t* self, display_xine_frame_t t, | 604 | void null_display_handler( xine_vo_driver_t* self, display_xine_frame_t t, |
605 | void* user_data ) { | 605 | void* user_data ) { |
606 | null_driver_t* this = (null_driver_t*) self; | 606 | null_driver_t* this = (null_driver_t*) self; |
607 | this->caller = user_data; | 607 | this->caller = user_data; |
608 | this->frameDis = t; | 608 | this->frameDis = t; |
609 | } | 609 | } |
610 | 610 | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 7b8ad7a..7d71d09 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -259,253 +259,252 @@ void VideoWidget::updateSlider( long i, long max ) { | |||
259 | return; | 259 | return; |
260 | } | 260 | } |
261 | int width = slider->width(); | 261 | int width = slider->width(); |
262 | int val = int((double)i * width / max); | 262 | int val = int((double)i * width / max); |
263 | if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) { | 263 | if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) { |
264 | if ( slider->value() != val ) { | 264 | if ( slider->value() != val ) { |
265 | slider->setValue( val ); | 265 | slider->setValue( val ); |
266 | } | 266 | } |
267 | if ( slider->maxValue() != width ) { | 267 | if ( slider->maxValue() != width ) { |
268 | slider->setMaxValue( width ); | 268 | slider->setMaxValue( width ); |
269 | } | 269 | } |
270 | } | 270 | } |
271 | } | 271 | } |
272 | 272 | ||
273 | void VideoWidget::setToggleButton( int i, bool down ) { | 273 | void VideoWidget::setToggleButton( int i, bool down ) { |
274 | if ( down != videoButtons[i].isDown ) { | 274 | if ( down != videoButtons[i].isDown ) { |
275 | toggleButton( i ); | 275 | toggleButton( i ); |
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
279 | void VideoWidget::toggleButton( int i ) { | 279 | void VideoWidget::toggleButton( int i ) { |
280 | videoButtons[i].isDown = !videoButtons[i].isDown; | 280 | videoButtons[i].isDown = !videoButtons[i].isDown; |
281 | QPainter p(this); | 281 | QPainter p(this); |
282 | paintButton ( &p, i ); | 282 | paintButton ( &p, i ); |
283 | } | 283 | } |
284 | 284 | ||
285 | void VideoWidget::paintButton( QPainter *p, int i ) { | 285 | void VideoWidget::paintButton( QPainter *p, int i ) { |
286 | 286 | ||
287 | if ( videoButtons[i].isDown ) { | 287 | if ( videoButtons[i].isDown ) { |
288 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 288 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
289 | } else { | 289 | } else { |
290 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 290 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
291 | } | 291 | } |
292 | } | 292 | } |
293 | 293 | ||
294 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 294 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
295 | for ( int i = 0; i < numVButtons; i++ ) { | 295 | for ( int i = 0; i < numVButtons; i++ ) { |
296 | if ( event->state() == QMouseEvent::LeftButton ) { | 296 | if ( event->state() == QMouseEvent::LeftButton ) { |
297 | // The test to see if the mouse click is inside the button or not | 297 | // The test to see if the mouse click is inside the button or not |
298 | int x = event->pos().x() - xoff; | 298 | int x = event->pos().x() - xoff; |
299 | int y = event->pos().y() - yoff; | 299 | int y = event->pos().y() - yoff; |
300 | 300 | ||
301 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 301 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
302 | && y < imgButtonMask->height() | 302 | && y < imgButtonMask->height() |
303 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 303 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
304 | 304 | ||
305 | if ( isOnButton && !videoButtons[i].isHeld ) { | 305 | if ( isOnButton && !videoButtons[i].isHeld ) { |
306 | videoButtons[i].isHeld = TRUE; | 306 | videoButtons[i].isHeld = TRUE; |
307 | toggleButton(i); | 307 | toggleButton(i); |
308 | 308 | ||
309 | switch (i) { | 309 | switch (i) { |
310 | case VideoVolUp: | 310 | case VideoVolUp: |
311 | emit moreClicked(); | 311 | emit moreClicked(); |
312 | return; | 312 | return; |
313 | case VideoVolDown: | 313 | case VideoVolDown: |
314 | emit lessClicked(); | 314 | emit lessClicked(); |
315 | return; | 315 | return; |
316 | } | 316 | } |
317 | } else if ( !isOnButton && videoButtons[i].isHeld ) { | 317 | } else if ( !isOnButton && videoButtons[i].isHeld ) { |
318 | videoButtons[i].isHeld = FALSE; | 318 | videoButtons[i].isHeld = FALSE; |
319 | toggleButton(i); | 319 | toggleButton(i); |
320 | } | 320 | } |
321 | } else { | 321 | } else { |
322 | 322 | ||
323 | if ( videoButtons[i].isHeld ) { | 323 | if ( videoButtons[i].isHeld ) { |
324 | videoButtons[i].isHeld = FALSE; | 324 | videoButtons[i].isHeld = FALSE; |
325 | if ( !videoButtons[i].isToggle ) { | 325 | if ( !videoButtons[i].isToggle ) { |
326 | setToggleButton( i, FALSE ); | 326 | setToggleButton( i, FALSE ); |
327 | } | 327 | } |
328 | 328 | ||
329 | switch(i) { | 329 | switch(i) { |
330 | 330 | ||
331 | case VideoPlay: { | 331 | case VideoPlay: { |
332 | if( mediaPlayerState->isPaused ) { | 332 | if( mediaPlayerState->isPaused ) { |
333 | setToggleButton( i, FALSE ); | 333 | setToggleButton( i, FALSE ); |
334 | mediaPlayerState->setPaused( FALSE ); | 334 | mediaPlayerState->setPaused( FALSE ); |
335 | return; | 335 | return; |
336 | } else if( !mediaPlayerState->isPaused ) { | 336 | } else if( !mediaPlayerState->isPaused ) { |
337 | setToggleButton( i, TRUE ); | 337 | setToggleButton( i, TRUE ); |
338 | mediaPlayerState->setPaused( TRUE ); | 338 | mediaPlayerState->setPaused( TRUE ); |
339 | return; | 339 | return; |
340 | } else { | 340 | } else { |
341 | return; | 341 | return; |
342 | } | 342 | } |
343 | } | 343 | } |
344 | 344 | ||
345 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; | 345 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; |
346 | case VideoNext: if(playList->whichList() ==0) mediaPlayerState->setNext(); return; | 346 | case VideoNext: if(playList->whichList() ==0) mediaPlayerState->setNext(); return; |
347 | case VideoPrevious: if(playList->whichList() ==0) mediaPlayerState->setPrev(); return; | 347 | case VideoPrevious: if(playList->whichList() ==0) mediaPlayerState->setPrev(); return; |
348 | case VideoVolUp: emit moreReleased(); return; | 348 | case VideoVolUp: emit moreReleased(); return; |
349 | case VideoVolDown: emit lessReleased(); return; | 349 | case VideoVolDown: emit lessReleased(); return; |
350 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 350 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
351 | } | 351 | } |
352 | } | 352 | } |
353 | } | 353 | } |
354 | } | 354 | } |
355 | } | 355 | } |
356 | 356 | ||
357 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 357 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
358 | mouseMoveEvent( event ); | 358 | mouseMoveEvent( event ); |
359 | } | 359 | } |
360 | 360 | ||
361 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 361 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
362 | if ( mediaPlayerState->fullscreen() ) { | 362 | if ( mediaPlayerState->fullscreen() ) { |
363 | mediaPlayerState->setFullscreen( FALSE ); | 363 | mediaPlayerState->setFullscreen( FALSE ); |
364 | makeVisible(); | 364 | makeVisible(); |
365 | } | 365 | } |
366 | mouseMoveEvent( event ); | 366 | mouseMoveEvent( event ); |
367 | } | 367 | } |
368 | 368 | ||
369 | void VideoWidget::showEvent( QShowEvent* ) { | 369 | void VideoWidget::showEvent( QShowEvent* ) { |
370 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 370 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
371 | mouseMoveEvent( &event ); | 371 | mouseMoveEvent( &event ); |
372 | } | 372 | } |
373 | 373 | ||
374 | 374 | ||
375 | void VideoWidget::backToNormal() { | 375 | void VideoWidget::backToNormal() { |
376 | mediaPlayerState->setFullscreen( FALSE ); | 376 | mediaPlayerState->setFullscreen( FALSE ); |
377 | makeVisible(); | 377 | makeVisible(); |
378 | } | 378 | } |
379 | 379 | ||
380 | void VideoWidget::makeVisible() { | 380 | void VideoWidget::makeVisible() { |
381 | if ( mediaPlayerState->fullscreen() ) { | 381 | if ( mediaPlayerState->fullscreen() ) { |
382 | setBackgroundMode( QWidget::NoBackground ); | 382 | setBackgroundMode( QWidget::NoBackground ); |
383 | showFullScreen(); | 383 | showFullScreen(); |
384 | resize( qApp->desktop()->size() ); | 384 | resize( qApp->desktop()->size() ); |
385 | slider->hide(); | 385 | slider->hide(); |
386 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 386 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
387 | // qApp->processEvents(); | ||
388 | } else { | 387 | } else { |
389 | showNormal(); | 388 | showNormal(); |
390 | showMaximized(); | 389 | showMaximized(); |
391 | setBackgroundPixmap( *pixBg ); | 390 | setBackgroundPixmap( *pixBg ); |
392 | if ( mediaPlayerState->streaming() ) { | 391 | if ( mediaPlayerState->seekable() ) { |
393 | slider->hide(); | 392 | slider->hide(); |
394 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 393 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
395 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 394 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
396 | } else { | 395 | } else { |
397 | slider->show(); | 396 | slider->show(); |
398 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 397 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
399 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 398 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
400 | } | 399 | } |
401 | QWidget *d = QApplication::desktop(); | 400 | QWidget *d = QApplication::desktop(); |
402 | int w=d->width(); | 401 | int w = d->width(); |
403 | int h=d->height(); | 402 | int h = d->height(); |
404 | 403 | ||
405 | if(w>h) { | 404 | if(w>h) { |
406 | int newW=(w/2)-(246/2); //this will only work with 320x240 | 405 | int newW=(w/2)-(246/2); //this will only work with 320x240 |
407 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); | 406 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); |
408 | } else | 407 | } else |
409 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); | 408 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); |
410 | 409 | ||
411 | // qApp->processEvents(); | 410 | // qApp->processEvents(); |
412 | } | 411 | } |
413 | } | 412 | } |
414 | 413 | ||
415 | 414 | ||
416 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 415 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
417 | QPainter p( this ); | 416 | QPainter p( this ); |
418 | 417 | ||
419 | if ( mediaPlayerState->fullscreen() ) { | 418 | if ( mediaPlayerState->fullscreen() ) { |
420 | // Clear the background | 419 | // Clear the background |
421 | p.setBrush( QBrush( Qt::black ) ); | 420 | p.setBrush( QBrush( Qt::black ) ); |
422 | } else { | 421 | } else { |
423 | if ( !pe->erased() ) { | 422 | if ( !pe->erased() ) { |
424 | // Combine with background and double buffer | 423 | // Combine with background and double buffer |
425 | QPixmap pix( pe->rect().size() ); | 424 | QPixmap pix( pe->rect().size() ); |
426 | QPainter p( &pix ); | 425 | QPainter p( &pix ); |
427 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 426 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
428 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 427 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |
429 | for ( int i = 0; i < numVButtons; i++ ) { | 428 | for ( int i = 0; i < numVButtons; i++ ) { |
430 | paintButton( &p, i ); | 429 | paintButton( &p, i ); |
431 | } | 430 | } |
432 | QPainter p2( this ); | 431 | QPainter p2( this ); |
433 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 432 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
434 | } else { | 433 | } else { |
435 | QPainter p( this ); | 434 | QPainter p( this ); |
436 | for ( int i = 0; i < numVButtons; i++ ) | 435 | for ( int i = 0; i < numVButtons; i++ ) |
437 | paintButton( &p, i ); | 436 | paintButton( &p, i ); |
438 | } | 437 | } |
439 | //slider->repaint( TRUE ); | 438 | //slider->repaint( TRUE ); |
440 | } | 439 | } |
441 | } | 440 | } |
442 | 441 | ||
443 | 442 | ||
444 | void VideoWidget::closeEvent( QCloseEvent* ) { | 443 | void VideoWidget::closeEvent( QCloseEvent* ) { |
445 | mediaPlayerState->setList(); | 444 | mediaPlayerState->setList(); |
446 | } | 445 | } |
447 | 446 | ||
448 | 447 | ||
449 | 448 | ||
450 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 449 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
451 | switch ( e->key() ) { | 450 | switch ( e->key() ) { |
452 | ////////////////////////////// Zaurus keys | 451 | ////////////////////////////// Zaurus keys |
453 | case Key_Home: | 452 | case Key_Home: |
454 | break; | 453 | break; |
455 | case Key_F9: //activity | 454 | case Key_F9: //activity |
456 | break; | 455 | break; |
457 | case Key_F10: //contacts | 456 | case Key_F10: //contacts |
458 | // hide(); | 457 | // hide(); |
459 | break; | 458 | break; |
460 | case Key_F11: //menu | 459 | case Key_F11: //menu |
461 | break; | 460 | break; |
462 | case Key_F12: //home | 461 | case Key_F12: //home |
463 | break; | 462 | break; |
464 | case Key_F13: //mail | 463 | case Key_F13: //mail |
465 | break; | 464 | break; |
466 | case Key_Space: { | 465 | case Key_Space: { |
467 | if(mediaPlayerState->playing()) { | 466 | if(mediaPlayerState->playing()) { |
468 | mediaPlayerState->setPlaying(FALSE); | 467 | mediaPlayerState->setPlaying(FALSE); |
469 | } else { | 468 | } else { |
470 | mediaPlayerState->setPlaying(TRUE); | 469 | mediaPlayerState->setPlaying(TRUE); |
471 | } | 470 | } |
472 | } | 471 | } |
473 | break; | 472 | break; |
474 | case Key_Down: | 473 | case Key_Down: |
475 | // toggleButton(6); | 474 | // toggleButton(6); |
476 | emit lessClicked(); | 475 | emit lessClicked(); |
477 | emit lessReleased(); | 476 | emit lessReleased(); |
478 | // toggleButton(6); | 477 | // toggleButton(6); |
479 | break; | 478 | break; |
480 | case Key_Up: | 479 | case Key_Up: |
481 | // toggleButton(5); | 480 | // toggleButton(5); |
482 | emit moreClicked(); | 481 | emit moreClicked(); |
483 | emit moreReleased(); | 482 | emit moreReleased(); |
484 | // toggleButton(5); | 483 | // toggleButton(5); |
485 | break; | 484 | break; |
486 | case Key_Right: | 485 | case Key_Right: |
487 | mediaPlayerState->setNext(); | 486 | mediaPlayerState->setNext(); |
488 | break; | 487 | break; |
489 | case Key_Left: | 488 | case Key_Left: |
490 | mediaPlayerState->setPrev(); | 489 | mediaPlayerState->setPrev(); |
491 | break; | 490 | break; |
492 | case Key_Escape: | 491 | case Key_Escape: |
493 | break; | 492 | break; |
494 | 493 | ||
495 | }; | 494 | }; |
496 | } | 495 | } |
497 | 496 | ||
498 | XineVideoWidget* VideoWidget::vidWidget() { | 497 | XineVideoWidget* VideoWidget::vidWidget() { |
499 | return videoFrame; | 498 | return videoFrame; |
500 | } | 499 | } |
501 | 500 | ||
502 | 501 | ||
503 | void VideoWidget::setFullscreen ( bool b ) { | 502 | void VideoWidget::setFullscreen ( bool b ) { |
504 | setToggleButton( VideoFullscreen, b ); | 503 | setToggleButton( VideoFullscreen, b ); |
505 | } | 504 | } |
506 | 505 | ||
507 | 506 | ||
508 | void VideoWidget::setPlaying( bool b) { | 507 | void VideoWidget::setPlaying( bool b) { |
509 | setToggleButton( VideoPlay, b ); | 508 | setToggleButton( VideoPlay, b ); |
510 | } | 509 | } |
511 | 510 | ||
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 03176b3..65ac127 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -1,230 +1,231 @@ | |||
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 | ..}^=.= = ; General Public License for more | 22 | ..}^=.= = ; 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 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = 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 | 34 | ||
35 | #include <qtimer.h> | 35 | #include <qtimer.h> |
36 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
37 | #include <qpe/qcopenvelope_qws.h> | 37 | #include <qpe/qcopenvelope_qws.h> |
38 | #include <qpe/qpeapplication.h> | 38 | #include <qpe/qpeapplication.h> |
39 | #include "xinecontrol.h" | 39 | #include "xinecontrol.h" |
40 | #include "mediaplayerstate.h" | 40 | #include "mediaplayerstate.h" |
41 | #include "videowidget.h" | 41 | #include "videowidget.h" |
42 | 42 | ||
43 | extern MediaPlayerState *mediaPlayerState; | 43 | extern MediaPlayerState *mediaPlayerState; |
44 | extern VideoWidget *videoUI; | 44 | extern VideoWidget *videoUI; |
45 | XineControl::XineControl( QObject *parent, const char *name ) | 45 | XineControl::XineControl( QObject *parent, const char *name ) |
46 | : QObject( parent, name ) { | 46 | : QObject( parent, name ) { |
47 | 47 | ||
48 | libXine = new XINE::Lib( videoUI->vidWidget() ); | 48 | libXine = new XINE::Lib( videoUI->vidWidget() ); |
49 | 49 | ||
50 | connect ( videoUI, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) ); | 50 | connect ( videoUI, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) ); |
51 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); | 51 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); |
52 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); | 52 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); |
53 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); | 53 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); |
54 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); | 54 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); |
55 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); | 55 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); |
56 | connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); | 56 | connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); |
57 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); | 57 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); |
58 | 58 | ||
59 | disabledSuspendScreenSaver = FALSE; | 59 | disabledSuspendScreenSaver = FALSE; |
60 | } | 60 | } |
61 | 61 | ||
62 | XineControl::~XineControl() { | 62 | XineControl::~XineControl() { |
63 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 63 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
64 | if ( disabledSuspendScreenSaver ) { | 64 | if ( disabledSuspendScreenSaver ) { |
65 | disabledSuspendScreenSaver = FALSE; | 65 | disabledSuspendScreenSaver = FALSE; |
66 | // Re-enable the suspend mode | 66 | // Re-enable the suspend mode |
67 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 67 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
68 | } | 68 | } |
69 | #endif | 69 | #endif |
70 | delete libXine; | 70 | delete libXine; |
71 | } | 71 | } |
72 | 72 | ||
73 | void XineControl::play( const QString& fileName ) { | 73 | void XineControl::play( const QString& fileName ) { |
74 | hasVideoChannel = FALSE; | 74 | hasVideoChannel = FALSE; |
75 | hasAudioChannel = FALSE; | 75 | hasAudioChannel = FALSE; |
76 | m_fileName = fileName; | 76 | m_fileName = fileName; |
77 | 77 | ||
78 | //qDebug("<<FILENAME: " + fileName + ">>>>"); | 78 | qDebug("<<FILENAME: " + fileName + ">>>>"); |
79 | 79 | ||
80 | if ( !libXine->play( fileName ) ) { | 80 | if ( !libXine->play( fileName, 0, 0 ) ) { |
81 | QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); | 81 | QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); |
82 | // toggle stop so the the play button is reset | 82 | // toggle stop so the the play button is reset |
83 | mediaPlayerState->setPlaying( false ); | 83 | mediaPlayerState->setPlaying( false ); |
84 | return; | 84 | return; |
85 | } | 85 | } |
86 | mediaPlayerState->setPlaying( true ); | 86 | mediaPlayerState->setPlaying( true ); |
87 | 87 | ||
88 | char whichGui; | 88 | char whichGui; |
89 | // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); | 89 | // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); |
90 | if ( !libXine->hasVideo() ) { | 90 | if ( !libXine->hasVideo() ) { |
91 | whichGui = 'a'; | 91 | whichGui = 'a'; |
92 | qDebug("HAS AUDIO"); | 92 | qDebug("HAS AUDIO"); |
93 | libXine->setShowVideo( false ); | 93 | libXine->setShowVideo( false ); |
94 | hasAudioChannel = TRUE; | 94 | hasAudioChannel = TRUE; |
95 | } else { | 95 | } else { |
96 | whichGui = 'v'; | 96 | whichGui = 'v'; |
97 | qDebug("HAS VIDEO"); | 97 | qDebug("HAS VIDEO"); |
98 | libXine->setShowVideo( true ); | 98 | libXine->setShowVideo( true ); |
99 | hasVideoChannel = TRUE; | 99 | hasVideoChannel = TRUE; |
100 | } | 100 | } |
101 | // determine if slider is shown | 101 | // determine if slider is shown |
102 | mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); | 102 | mediaPlayerState->setIsSeekable( !libXine->isSeekable() ); |
103 | |||
103 | // which gui (video / audio) | 104 | // which gui (video / audio) |
104 | mediaPlayerState->setView( whichGui ); | 105 | mediaPlayerState->setView( whichGui ); |
105 | 106 | ||
106 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 107 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
107 | if ( !disabledSuspendScreenSaver ) { | 108 | if ( !disabledSuspendScreenSaver ) { |
108 | disabledSuspendScreenSaver = TRUE; | 109 | disabledSuspendScreenSaver = TRUE; |
109 | // Stop the screen from blanking and power saving state | 110 | // Stop the screen from blanking and power saving state |
110 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) | 111 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) |
111 | << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); | 112 | << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); |
112 | } | 113 | } |
113 | #endif | 114 | #endif |
114 | 115 | ||
115 | length(); | 116 | length(); |
116 | position(); | 117 | position(); |
117 | } | 118 | } |
118 | 119 | ||
119 | void XineControl::nextMedia() { | 120 | void XineControl::nextMedia() { |
120 | mediaPlayerState->setNext(); | 121 | mediaPlayerState->setNext(); |
121 | } | 122 | } |
122 | 123 | ||
123 | void XineControl::setGamma( int value ) { | 124 | void XineControl::setGamma( int value ) { |
124 | libXine->setGamma( value ); | 125 | libXine->setGamma( value ); |
125 | } | 126 | } |
126 | 127 | ||
127 | void XineControl::stop( bool isSet ) { | 128 | void XineControl::stop( bool isSet ) { |
128 | if ( !isSet ) { | 129 | if ( !isSet ) { |
129 | libXine->stop(); | 130 | libXine->stop(); |
130 | 131 | ||
131 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 132 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
132 | if ( disabledSuspendScreenSaver ) { | 133 | if ( disabledSuspendScreenSaver ) { |
133 | disabledSuspendScreenSaver = FALSE; | 134 | disabledSuspendScreenSaver = FALSE; |
134 | // Re-enable the suspend mode | 135 | // Re-enable the suspend mode |
135 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 136 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
136 | } | 137 | } |
137 | #endif | 138 | #endif |
138 | } | 139 | } |
139 | } | 140 | } |
140 | 141 | ||
141 | /** | 142 | /** |
142 | * Pause playback | 143 | * Pause playback |
143 | * @isSet | 144 | * @isSet |
144 | */ | 145 | */ |
145 | void XineControl::pause( bool isSet) { | 146 | void XineControl::pause( bool isSet) { |
146 | if ( isSet ) { | 147 | if ( isSet ) { |
147 | libXine->pause(); | 148 | libXine->pause(); |
148 | } else { | 149 | } else { |
149 | libXine->play( m_fileName, 0, m_currentTime ); | 150 | libXine->play( m_fileName, 0, m_currentTime ); |
150 | } | 151 | } |
151 | } | 152 | } |
152 | 153 | ||
153 | 154 | ||
154 | /** | 155 | /** |
155 | * get current time in playback | 156 | * get current time in playback |
156 | */ | 157 | */ |
157 | long XineControl::currentTime() { | 158 | long XineControl::currentTime() { |
158 | // todo: jede sekunde überprüfen | 159 | // todo: jede sekunde überprüfen |
159 | m_currentTime = libXine->currentTime(); | 160 | m_currentTime = libXine->currentTime(); |
160 | return m_currentTime; | 161 | return m_currentTime; |
161 | QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); | 162 | QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); |
162 | } | 163 | } |
163 | 164 | ||
164 | /** | 165 | /** |
165 | * Set the length of the media file | 166 | * Set the length of the media file |
166 | */ | 167 | */ |
167 | void XineControl::length() { | 168 | void XineControl::length() { |
168 | m_length = libXine->length(); | 169 | m_length = libXine->length(); |
169 | mediaPlayerState->setLength( m_length ); | 170 | mediaPlayerState->setLength( m_length ); |
170 | } | 171 | } |
171 | 172 | ||
172 | 173 | ||
173 | /** | 174 | /** |
174 | * Reports the position the xine backend is at right now | 175 | * Reports the position the xine backend is at right now |
175 | * @return long the postion in seconds | 176 | * @return long the postion in seconds |
176 | */ | 177 | */ |
177 | long XineControl::position() { | 178 | long XineControl::position() { |
178 | m_position = ( currentTime() ); | 179 | m_position = ( currentTime() ); |
179 | mediaPlayerState->updatePosition( m_position ); | 180 | mediaPlayerState->updatePosition( m_position ); |
180 | long emitPos = (long)m_position; | 181 | long emitPos = (long)m_position; |
181 | emit positionChanged( emitPos ); | 182 | emit positionChanged( emitPos ); |
182 | if( mediaPlayerState->isPlaying ) { | 183 | if( mediaPlayerState->isPlaying ) { |
183 | // needs to be stopped the media is stopped | 184 | // needs to be stopped the media is stopped |
184 | QTimer::singleShot( 1000, this, SLOT( position() ) ); | 185 | QTimer::singleShot( 1000, this, SLOT( position() ) ); |
185 | } | 186 | } |
186 | // qDebug("POSITION : %d", m_position); | 187 | // qDebug("POSITION : %d", m_position); |
187 | return m_position; | 188 | return m_position; |
188 | } | 189 | } |
189 | 190 | ||
190 | /** | 191 | /** |
191 | * Set videoplayback to fullscreen | 192 | * Set videoplayback to fullscreen |
192 | * @param isSet | 193 | * @param isSet |
193 | */ | 194 | */ |
194 | void XineControl::setFullscreen( bool isSet ) { | 195 | void XineControl::setFullscreen( bool isSet ) { |
195 | libXine->showVideoFullScreen( isSet ); | 196 | libXine->showVideoFullScreen( isSet ); |
196 | } | 197 | } |
197 | 198 | ||
198 | 199 | ||
199 | QString XineControl::getMetaInfo() { | 200 | QString XineControl::getMetaInfo() { |
200 | 201 | ||
201 | QString returnString; | 202 | QString returnString; |
202 | 203 | ||
203 | if ( !libXine->metaInfo( 0 ).isEmpty() ) { | 204 | if ( !libXine->metaInfo( 0 ).isEmpty() ) { |
204 | returnString += tr( " Title: " + libXine->metaInfo( 0 ) ); | 205 | returnString += tr( " Title: " + libXine->metaInfo( 0 ) ); |
205 | } | 206 | } |
206 | 207 | ||
207 | if ( !libXine->metaInfo( 1 ).isEmpty() ) { | 208 | if ( !libXine->metaInfo( 1 ).isEmpty() ) { |
208 | returnString += tr( " Comment: " + libXine->metaInfo( 1 ) ); | 209 | returnString += tr( " Comment: " + libXine->metaInfo( 1 ) ); |
209 | } | 210 | } |
210 | 211 | ||
211 | if ( !libXine->metaInfo( 2 ).isEmpty() ) { | 212 | if ( !libXine->metaInfo( 2 ).isEmpty() ) { |
212 | returnString += tr( " Artist: " + libXine->metaInfo( 2 ) ); | 213 | returnString += tr( " Artist: " + libXine->metaInfo( 2 ) ); |
213 | } | 214 | } |
214 | 215 | ||
215 | if ( !libXine->metaInfo( 3 ).isEmpty() ) { | 216 | if ( !libXine->metaInfo( 3 ).isEmpty() ) { |
216 | returnString += tr( " Genre: " + libXine->metaInfo( 3 ) ); | 217 | returnString += tr( " Genre: " + libXine->metaInfo( 3 ) ); |
217 | } | 218 | } |
218 | 219 | ||
219 | if ( !libXine->metaInfo( 4 ).isEmpty() ) { | 220 | if ( !libXine->metaInfo( 4 ).isEmpty() ) { |
220 | returnString += tr( " Album: " + libXine->metaInfo( 4 ) ); | 221 | returnString += tr( " Album: " + libXine->metaInfo( 4 ) ); |
221 | } | 222 | } |
222 | 223 | ||
223 | if ( !libXine->metaInfo( 5 ).isEmpty() ) { | 224 | if ( !libXine->metaInfo( 5 ).isEmpty() ) { |
224 | returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); | 225 | returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); |
225 | } | 226 | } |
226 | return returnString; | 227 | return returnString; |
227 | } | 228 | } |
228 | 229 | ||
229 | QString XineControl::getErrorCode() { | 230 | QString XineControl::getErrorCode() { |
230 | 231 | ||