summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-11-10 15:09:09 (UTC)
committer harlekin <harlekin>2002-11-10 15:09:09 (UTC)
commit91932ca42cee5568477b1e49532a0b9e4d9bcf96 (patch) (unidiff)
treef134612cf7aa15787077b0a76c34aab30d72cae3
parentb6b57412a12c06d07f22060b7a165d71e5eddb84 (diff)
downloadopie-91932ca42cee5568477b1e49532a0b9e4d9bcf96.zip
opie-91932ca42cee5568477b1e49532a0b9e4d9bcf96.tar.gz
opie-91932ca42cee5568477b1e49532a0b9e4d9bcf96.tar.bz2
besser seekable handling
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp33
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h1
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp16
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h4
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp7
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp7
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
@@ -1,582 +1,583 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include <qpe/qpeapplication.h> 34#include <qpe/qpeapplication.h>
35#include <qpe/resource.h> 35#include <qpe/resource.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37 37
38#include <qwidget.h> 38#include <qwidget.h>
39#include <qpixmap.h> 39#include <qpixmap.h>
40#include <qbutton.h> 40#include <qbutton.h>
41#include <qpainter.h> 41#include <qpainter.h>
42#include <qframe.h> 42#include <qframe.h>
43#include <qlayout.h> 43#include <qlayout.h>
44#include <qdir.h> 44#include <qdir.h>
45#include <stdlib.h> 45#include <stdlib.h>
46#include <stdio.h> 46#include <stdio.h>
47 47
48#include "audiowidget.h" 48#include "audiowidget.h"
49#include "mediaplayerstate.h" 49#include "mediaplayerstate.h"
50#include "playlistwidget.h" 50#include "playlistwidget.h"
51 51
52extern MediaPlayerState *mediaPlayerState; 52extern MediaPlayerState *mediaPlayerState;
53extern PlayListWidget *playList; 53extern PlayListWidget *playList;
54 54
55static const int xo = -2; // movable x offset 55static const int xo = -2; // movable x offset
56static const int yo = 22; // movable y offset 56static const int yo = 22; // movable y offset
57 57
58 58
59Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) { 59Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) {
60 setFrameStyle( WinPanel | Sunken ); 60 setFrameStyle( WinPanel | Sunken );
61 //setText( "No Song" ); 61 //setText( "No Song" );
62} 62}
63 63
64Ticker::~Ticker() { 64Ticker::~Ticker() {
65} 65}
66 66
67void Ticker::setText( const QString& text ) { 67void 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
79void Ticker::timerEvent( QTimerEvent * ) { 79void 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
85void Ticker::drawContents( QPainter *p ) { 85void 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
98struct MediaButton { 98struct 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)
103MediaButton audioButtons[] = { 103MediaButton 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
116const char *skin_mask_file_names[10] = { 116const 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
122static void changeTextColor( QWidget *w ) { 122static 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
129static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); 129static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
130 130
131 131
132AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : 132AudioWidget::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
217AudioWidget::~AudioWidget() { 215AudioWidget::~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
233namespace { 231namespace {
234 232
235QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 233QPixmap *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
244QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) { 242QPixmap *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
252void AudioWidget::resizeEvent( QResizeEvent * ) { 250void 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
282static bool audioSliderBeingMoved = FALSE; 280static bool audioSliderBeingMoved = FALSE;
283 281
284 282
285void AudioWidget::sliderPressed() { 283void AudioWidget::sliderPressed() {
286 audioSliderBeingMoved = TRUE; 284 audioSliderBeingMoved = TRUE;
287} 285}
288 286
289 287
290void AudioWidget::sliderReleased() { 288void 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
298void AudioWidget::setPosition( long i ) { 296void 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
304void AudioWidget::setLength( long max ) { 302void AudioWidget::setLength( long max ) {
305 updateSlider( mediaPlayerState->position(), max ); 303 updateSlider( mediaPlayerState->position(), max );
306} 304}
307 305
308 306
309void AudioWidget::setView( char view ) { 307void AudioWidget::setView( char view ) {
310 308
311 // this isnt working for some reason 309if ( view == 'a' ) {
310 // startTimer( 150 );
311 showMaximized();
312 } else {
313 killTimers();
314 hide();
315 }
316 // qApp->processEvents();
317}
318
319
320void 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
339static QString timeAsString( long length ) { 340static 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
345void AudioWidget::updateSlider( long i, long max ) { 346void 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
369void AudioWidget::setToggleButton( int i, bool down ) { 370void 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
377void AudioWidget::toggleButton( int i ) { 378void 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
384void AudioWidget::paintButton( QPainter *p, int i ) { 385void 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
393void AudioWidget::skipFor() { 394void 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
399void AudioWidget::skipBack() { 400void 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
407void AudioWidget::stopSkip() { 408void AudioWidget::stopSkip() {
408 killTimers(); 409 killTimers();
409} 410}
410 411
411 412
412void AudioWidget::timerEvent( QTimerEvent * ) { 413void 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
421void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { 422void 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 );
464 return; 465 return;
465 } else if( !mediaPlayerState->isPaused ) { 466 } else if( !mediaPlayerState->isPaused ) {
466 mediaPlayerState->setPaused( TRUE ); 467 mediaPlayerState->setPaused( TRUE );
467 return; 468 return;
468 } 469 }
469 case AudioStop: mediaPlayerState->setPlaying(FALSE); return; 470 case AudioStop: mediaPlayerState->setPlaying(FALSE); return;
470 case AudioNext: if( playList->whichList() ==0 ) mediaPlayerState->setNext(); return; 471 case AudioNext: if( playList->whichList() ==0 ) mediaPlayerState->setNext(); return;
471 case AudioPrevious: if( playList->whichList() ==0 ) mediaPlayerState->setPrev(); return; 472 case AudioPrevious: if( playList->whichList() ==0 ) mediaPlayerState->setPrev(); return;
472 case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; 473 case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return;
473 case AudioVolumeUp: emit moreReleased(); return; 474 case AudioVolumeUp: emit moreReleased(); return;
474 case AudioVolumeDown: emit lessReleased(); return; 475 case AudioVolumeDown: emit lessReleased(); return;
475 case AudioPlayList: mediaPlayerState->setList(); return; 476 case AudioPlayList: mediaPlayerState->setList(); return;
476 case AudioForward: emit forwardReleased(); return; 477 case AudioForward: emit forwardReleased(); return;
477 case AudioBack: emit backReleased(); return; 478 case AudioBack: emit backReleased(); return;
478 } 479 }
479 } 480 }
480 } 481 }
481 } 482 }
482} 483}
483 484
484 485
485void AudioWidget::mousePressEvent( QMouseEvent *event ) { 486void AudioWidget::mousePressEvent( QMouseEvent *event ) {
486 mouseMoveEvent( event ); 487 mouseMoveEvent( event );
487} 488}
488 489
489 490
490void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { 491void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) {
491 mouseMoveEvent( event ); 492 mouseMoveEvent( event );
492} 493}
493 494
494 495
495void AudioWidget::showEvent( QShowEvent* ) { 496void AudioWidget::showEvent( QShowEvent* ) {
496 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 497 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
497 mouseMoveEvent( &event ); 498 mouseMoveEvent( &event );
498} 499}
499 500
500 501
501void AudioWidget::closeEvent( QCloseEvent* ) { 502void AudioWidget::closeEvent( QCloseEvent* ) {
502 mediaPlayerState->setList(); 503 mediaPlayerState->setList();
503} 504}
504 505
505 506
506void AudioWidget::paintEvent( QPaintEvent * pe ) { 507void AudioWidget::paintEvent( QPaintEvent * pe ) {
507 if ( !pe->erased() ) { 508 if ( !pe->erased() ) {
508 // Combine with background and double buffer 509 // Combine with background and double buffer
509 QPixmap pix( pe->rect().size() ); 510 QPixmap pix( pe->rect().size() );
510 QPainter p( &pix ); 511 QPainter p( &pix );
511 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 512 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
512 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); 513 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
513 for ( int i = 0; i < numButtons; i++ ) 514 for ( int i = 0; i < numButtons; i++ )
514 paintButton( &p, i ); 515 paintButton( &p, i );
515 QPainter p2( this ); 516 QPainter p2( this );
516 p2.drawPixmap( pe->rect().topLeft(), pix ); 517 p2.drawPixmap( pe->rect().topLeft(), pix );
517 } else { 518 } else {
518 QPainter p( this ); 519 QPainter p( this );
519 for ( int i = 0; i < numButtons; i++ ) 520 for ( int i = 0; i < numButtons; i++ )
520 paintButton( &p, i ); 521 paintButton( &p, i );
521 } 522 }
522} 523}
523 524
524void AudioWidget::keyReleaseEvent( QKeyEvent *e) { 525void AudioWidget::keyReleaseEvent( QKeyEvent *e) {
525 switch ( e->key() ) { 526 switch ( e->key() ) {
526 ////////////////////////////// Zaurus keys 527 ////////////////////////////// Zaurus keys
527 case Key_Home: 528 case Key_Home:
528 break; 529 break;
529 case Key_F9: //activity 530 case Key_F9: //activity
530 hide(); 531 hide();
531 // qDebug("Audio F9"); 532 // qDebug("Audio F9");
532 break; 533 break;
533 case Key_F10: //contacts 534 case Key_F10: //contacts
534 break; 535 break;
535 case Key_F11: //menu 536 case Key_F11: //menu
536 mediaPlayerState->toggleBlank(); 537 mediaPlayerState->toggleBlank();
537 break; 538 break;
538 case Key_F12: //home 539 case Key_F12: //home
539 break; 540 break;
540 case Key_F13: //mail 541 case Key_F13: //mail
541 mediaPlayerState->toggleBlank(); 542 mediaPlayerState->toggleBlank();
542 break; 543 break;
543 case Key_Space: { 544 case Key_Space: {
544 if(mediaPlayerState->playing()) { 545 if(mediaPlayerState->playing()) {
545 // toggleButton(1); 546 // toggleButton(1);
546 mediaPlayerState->setPlaying(FALSE); 547 mediaPlayerState->setPlaying(FALSE);
547 // toggleButton(1); 548 // toggleButton(1);
548 } else { 549 } else {
549 // toggleButton(0); 550 // toggleButton(0);
550 mediaPlayerState->setPlaying(TRUE); 551 mediaPlayerState->setPlaying(TRUE);
551 // toggleButton(0); 552 // toggleButton(0);
552 } 553 }
553 } 554 }
554 break; 555 break;
555 case Key_Down: 556 case Key_Down:
556 // toggleButton(6); 557 // toggleButton(6);
557 emit lessClicked(); 558 emit lessClicked();
558 emit lessReleased(); 559 emit lessReleased();
559 // toggleButton(6); 560 // toggleButton(6);
560 break; 561 break;
561 case Key_Up: 562 case Key_Up:
562 // toggleButton(5); 563 // toggleButton(5);
563 emit moreClicked(); 564 emit moreClicked();
564 emit moreReleased(); 565 emit moreReleased();
565 // toggleButton(5); 566 // toggleButton(5);
566 break; 567 break;
567 case Key_Right: 568 case Key_Right:
568 // toggleButton(3); 569 // toggleButton(3);
569 mediaPlayerState->setNext(); 570 mediaPlayerState->setNext();
570 // toggleButton(3); 571 // toggleButton(3);
571 break; 572 break;
572 case Key_Left: 573 case Key_Left:
573 // toggleButton(4); 574 // toggleButton(4);
574 mediaPlayerState->setPrev(); 575 mediaPlayerState->setPrev();
575 // toggleButton(4); 576 // toggleButton(4);
576 break; 577 break;
577 case Key_Escape: { 578 case Key_Escape: {
578 } 579 }
579 break; 580 break;
580 581
581 }; 582 };
582} 583}
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
47class QPixmap; 47class QPixmap;
48 48
49namespace { 49namespace {
50 50
51enum AudioButtons { 51enum 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
65class Ticker : public QFrame { 65class Ticker : public QFrame {
66 Q_OBJECT 66 Q_OBJECT
67 67
68public: 68public:
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
73protected: 73protected:
74 void timerEvent( QTimerEvent * ); 74 void timerEvent( QTimerEvent * );
75 void drawContents( QPainter *p ); 75 void drawContents( QPainter *p );
76private: 76private:
77 QString scrollText; 77 QString scrollText;
78 int pos, pixelLen; 78 int pos, pixelLen;
79}; 79};
80 80
81 81
82class AudioWidget : public QWidget { 82class AudioWidget : public QWidget {
83 Q_OBJECT 83 Q_OBJECT
84public: 84public:
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 ); }
88public slots: 88public 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
99signals: 100signals:
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
110protected: 111protected:
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);
122private slots: 123private slots:
123 void skipFor(); 124 void skipFor();
124 void skipBack(); 125 void skipBack();
125 void stopSkip(); 126 void stopSkip();
126private: 127private:
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
@@ -48,317 +48,317 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name )
48 48
49 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 49 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
50 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 50 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
51 connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); 51 connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) );
52 52
53 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 53 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
54 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 54 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
55 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 55 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
56 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 56 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
57 57
58 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 58 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
59 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 59 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
60 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 60 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
61 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 61 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
62 62
63 volControl = new VolumeControl; 63 volControl = new VolumeControl;
64 xineControl = new XineControl(); 64 xineControl = new XineControl();
65 playList->setCaption(tr("OpiePlayer")); 65 playList->setCaption(tr("OpiePlayer"));
66} 66}
67 67
68MediaPlayer::~MediaPlayer() { 68MediaPlayer::~MediaPlayer() {
69 delete xineControl; 69 delete xineControl;
70 delete volControl; 70 delete volControl;
71} 71}
72 72
73void MediaPlayer::pauseCheck( bool b ) { 73void MediaPlayer::pauseCheck( bool b ) {
74 if ( b && !mediaPlayerState->playing() ) { 74 if ( b && !mediaPlayerState->playing() ) {
75 mediaPlayerState->setPaused( FALSE ); 75 mediaPlayerState->setPaused( FALSE );
76 } 76 }
77} 77}
78 78
79void MediaPlayer::play() { 79void MediaPlayer::play() {
80 mediaPlayerState->setPlaying( FALSE ); 80 mediaPlayerState->setPlaying( FALSE );
81 mediaPlayerState->setPlaying( TRUE ); 81 mediaPlayerState->setPlaying( TRUE );
82} 82}
83 83
84void MediaPlayer::setPlaying( bool play ) { 84void MediaPlayer::setPlaying( bool play ) {
85 if ( !play ) { 85 if ( !play ) {
86 return; 86 return;
87 } 87 }
88 88
89 if ( mediaPlayerState->paused() ) { 89 if ( mediaPlayerState->paused() ) {
90 mediaPlayerState->setPaused( FALSE ); 90 mediaPlayerState->setPaused( FALSE );
91 return; 91 return;
92 } 92 }
93 93
94 QString tickerText, time, fileName; 94 QString tickerText, time, fileName;
95 if( playList->whichList() == 0 ) { //check for filelist 95 if( playList->whichList() == 0 ) { //check for filelist
96 const DocLnk *playListCurrent = playList->current(); 96 const DocLnk *playListCurrent = playList->current();
97 if ( playListCurrent != NULL ) { 97 if ( playListCurrent != NULL ) {
98 currentFile = playListCurrent; 98 currentFile = playListCurrent;
99 } 99 }
100 xineControl->play( currentFile->file() ); 100 xineControl->play( currentFile->file() );
101 fileName = currentFile->name(); 101 fileName = currentFile->name();
102 long seconds = mediaPlayerState->length();// 102 long seconds = mediaPlayerState->length();//
103 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 103 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
104 //qDebug(time); 104 //qDebug(time);
105 105
106 } else { 106 } else {
107 //if playing in file list.. play in a different way 107 //if playing in file list.. play in a different way
108 // random and looping settings enabled causes problems here, 108 // random and looping settings enabled causes problems here,
109 // since there is no selected file in the playlist, but a selected file in the file list, 109 // since there is no selected file in the playlist, but a selected file in the file list,
110 // so we remember and shutoff 110 // so we remember and shutoff
111 l = mediaPlayerState->looping(); 111 l = mediaPlayerState->looping();
112 if(l) { 112 if(l) {
113 mediaPlayerState->setLooping( false ); 113 mediaPlayerState->setLooping( false );
114 } 114 }
115 r = mediaPlayerState->shuffled(); 115 r = mediaPlayerState->shuffled();
116 mediaPlayerState->setShuffled( false ); 116 mediaPlayerState->setShuffled( false );
117 117
118 fileName = playList->currentFileListPathName(); 118 fileName = playList->currentFileListPathName();
119 xineControl->play( fileName ); 119 xineControl->play( fileName );
120 long seconds = mediaPlayerState->length(); 120 long seconds = mediaPlayerState->length();
121 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 121 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
122 //qDebug(time); 122 //qDebug(time);
123 if( fileName.left(4) != "http" ) { 123 if( fileName.left(4) != "http" ) {
124 fileName = QFileInfo( fileName ).baseName(); 124 fileName = QFileInfo( fileName ).baseName();
125 } 125 }
126 126
127 } 127 }
128 128
129 if( fileName.left(4) == "http" ) { 129 if( fileName.left(4) == "http" ) {
130 if ( xineControl->getMetaInfo().isEmpty() ) { 130 if ( xineControl->getMetaInfo().isEmpty() ) {
131 tickerText = tr( " File: " ) + fileName; 131 tickerText = tr( " File: " ) + fileName;
132 } else { 132 } else {
133 tickerText = xineControl->getMetaInfo(); 133 tickerText = xineControl->getMetaInfo();
134 } 134 }
135 } else { 135 } else {
136 if ( xineControl->getMetaInfo().isEmpty() ) { 136 if ( xineControl->getMetaInfo().isEmpty() ) {
137 tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; 137 tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " ";
138 } else { 138 } else {
139 tickerText = xineControl->getMetaInfo() + " Length: " + time + " "; 139 tickerText = xineControl->getMetaInfo() + " Length: " + time + " ";
140 } 140 }
141 } 141 }
142 audioUI->setTickerText( tickerText ); 142 audioUI->setTickerText( tickerText );
143} 143}
144 144
145 145
146void MediaPlayer::prev() { 146void MediaPlayer::prev() {
147 if( playList->whichList() == 0 ) { //if using the playlist 147 if( playList->whichList() == 0 ) { //if using the playlist
148 if ( playList->prev() ) { 148 if ( playList->prev() ) {
149 play(); 149 play();
150 } else if ( mediaPlayerState->looping() ) { 150 } else if ( mediaPlayerState->looping() ) {
151 if ( playList->last() ) { 151 if ( playList->last() ) {
152 play(); 152 play();
153 } 153 }
154 } else { 154 } else {
155 mediaPlayerState->setList(); 155 mediaPlayerState->setList();
156 } 156 }
157 } 157 }
158} 158}
159 159
160 160
161void MediaPlayer::next() { 161void MediaPlayer::next() {
162 162
163 if(playList->whichList() == 0) { //if using the playlist 163 if(playList->whichList() == 0) { //if using the playlist
164 if ( playList->next() ) { 164 if ( playList->next() ) {
165 play(); 165 play();
166 } else if ( mediaPlayerState->looping() ) { 166 } else if ( mediaPlayerState->looping() ) {
167 if ( playList->first() ) { 167 if ( playList->first() ) {
168 play(); 168 play();
169 } 169 }
170 } else { 170 } else {
171 mediaPlayerState->setList(); 171 mediaPlayerState->setList();
172 } 172 }
173 } else { //if playing from file list, let's just stop 173 } else { //if playing from file list, let's just stop
174 qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); 174 qDebug("<<<<<<<<<<<<<<<<<stop for filelists");
175 mediaPlayerState->setPlaying(false); 175 mediaPlayerState->setPlaying(false);
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
184void MediaPlayer::startDecreasingVolume() { 184void 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
191void MediaPlayer::startIncreasingVolume() { 191void 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
198bool drawnOnScreenDisplay = FALSE; 198bool drawnOnScreenDisplay = FALSE;
199unsigned int onScreenDisplayVolume = 0; 199unsigned int onScreenDisplayVolume = 0;
200const int yoff = 110; 200const int yoff = 110;
201 201
202void MediaPlayer::stopChangingVolume() { 202void 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
221void MediaPlayer::timerEvent( QTimerEvent * ) { 221void 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
300void MediaPlayer::blank( bool b ) { 300void 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
335void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 335void 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
357void MediaPlayer::cleanUp() {// this happens on closing 357void 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,324 +1,338 @@
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
50MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) 50MediaPlayerState::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
58MediaPlayerState::~MediaPlayerState() { 59MediaPlayerState::~MediaPlayerState() {
59} 60}
60 61
61 62
62void MediaPlayerState::readConfig( Config& cfg ) { 63void 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
80void MediaPlayerState::writeConfig( Config& cfg ) const { 81void 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
94bool MediaPlayerState::streaming() { 95bool MediaPlayerState::streaming() {
95 return isStreaming; 96 return isStreaming;
96} 97}
97 98
99bool MediaPlayerState::seekable() {
100 return isSeekable;
101}
102
98bool MediaPlayerState::fullscreen() { 103bool MediaPlayerState::fullscreen() {
99 return isFullscreen; 104 return isFullscreen;
100} 105}
101 106
102bool MediaPlayerState::scaled() { 107bool MediaPlayerState::scaled() {
103 return isScaled; 108 return isScaled;
104} 109}
105 110
106bool MediaPlayerState::looping() { 111bool MediaPlayerState::looping() {
107 return isLooping; 112 return isLooping;
108} 113}
109 114
110bool MediaPlayerState::shuffled() { 115bool MediaPlayerState::shuffled() {
111 return isShuffled; 116 return isShuffled;
112} 117}
113 118
114 119
115bool MediaPlayerState:: playlist() { 120bool MediaPlayerState::playlist() {
116 return usePlaylist; 121 return usePlaylist;
117} 122}
118 123
119bool MediaPlayerState::paused() { 124bool MediaPlayerState::paused() {
120 return isPaused; 125 return isPaused;
121} 126}
122 127
123bool MediaPlayerState::playing() { 128bool MediaPlayerState::playing() {
124 return isPlaying; 129 return isPlaying;
125} 130}
126 131
127bool MediaPlayerState::stop() { 132bool MediaPlayerState::stop() {
128 return isStoped; 133 return isStoped;
129} 134}
130 135
131long MediaPlayerState::position() { 136long MediaPlayerState::position() {
132 return curPosition; 137 return curPosition;
133} 138}
134 139
135long MediaPlayerState::length() { 140long MediaPlayerState::length() {
136 return curLength; 141 return curLength;
137} 142}
138 143
139char MediaPlayerState::view() { 144char MediaPlayerState::view() {
140 return curView; 145 return curView;
141} 146}
142 147
143// slots 148// slots
144void MediaPlayerState::setIsStreaming( bool b ) { 149void 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
157void MediaPlayerState::setIsSeekable( bool b ) {
158
159 //if ( isSeekable == b ) {
160 // return;
161 // }
162 isSeekable = b;
163 emit isSeekableToggled(b);
164}
165
152 166
153void MediaPlayerState::setFullscreen( bool b ) { 167void 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
162void MediaPlayerState::setBlanked( bool b ) { 176void 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
171void MediaPlayerState::setScaled( bool b ) { 185void 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
179void MediaPlayerState::setLooping( bool b ) { 193void 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
187void MediaPlayerState::setShuffled( bool b ) { 201void 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
195void MediaPlayerState::setPlaylist( bool b ) { 209void 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
203void MediaPlayerState::setPaused( bool b ) { 217void 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
213void MediaPlayerState::setPlaying( bool b ) { 227void 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
222void MediaPlayerState::setStop( bool b ) { 236void 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
230void MediaPlayerState::setPosition( long p ) { 244void 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
238void MediaPlayerState::updatePosition( long p ){ 252void 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
246void MediaPlayerState::setVideoGamma( int v ){ 260void 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
254void MediaPlayerState::setLength( long l ) { 268void 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
262void MediaPlayerState::setView( char v ) { 276void 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
270void MediaPlayerState::setPrev(){ 284void MediaPlayerState::setPrev(){
271 emit prev(); 285 emit prev();
272} 286}
273 287
274void MediaPlayerState::setNext() { 288void MediaPlayerState::setNext() {
275 emit next(); 289 emit next();
276} 290}
277 291
278void MediaPlayerState::setList() { 292void MediaPlayerState::setList() {
279 setPlaying( FALSE ); 293 setPlaying( FALSE );
280 setView('l'); 294 setView('l');
281} 295}
282 296
283void MediaPlayerState::setVideo() { 297void MediaPlayerState::setVideo() {
284 setView('v'); 298 setView('v');
285} 299}
286 300
287void MediaPlayerState::setAudio() { 301void MediaPlayerState::setAudio() {
288 setView('a'); 302 setView('a');
289} 303}
290 304
291void MediaPlayerState::toggleFullscreen() { 305void MediaPlayerState::toggleFullscreen() {
292 setFullscreen( !isFullscreen ); 306 setFullscreen( !isFullscreen );
293} 307}
294 308
295void MediaPlayerState::toggleScaled() { 309void MediaPlayerState::toggleScaled() {
296 setScaled( !isScaled); 310 setScaled( !isScaled);
297} 311}
298 312
299void MediaPlayerState::toggleLooping() { 313void MediaPlayerState::toggleLooping() {
300 setLooping( !isLooping); 314 setLooping( !isLooping);
301} 315}
302 316
303void MediaPlayerState::toggleShuffled() { 317void MediaPlayerState::toggleShuffled() {
304 setShuffled( !isShuffled); 318 setShuffled( !isShuffled);
305} 319}
306 320
307void MediaPlayerState::togglePlaylist() { 321void MediaPlayerState::togglePlaylist() {
308 setPlaylist( !usePlaylist); 322 setPlaylist( !usePlaylist);
309} 323}
310 324
311void MediaPlayerState::togglePaused() { 325void MediaPlayerState::togglePaused() {
312 setPaused( !isPaused); 326 setPaused( !isPaused);
313} 327}
314 328
315void MediaPlayerState::togglePlaying() { 329void MediaPlayerState::togglePlaying() {
316 setPlaying( !isPlaying); 330 setPlaying( !isPlaying);
317} 331}
318 332
319void MediaPlayerState::toggleBlank() { 333void MediaPlayerState::toggleBlank() {
320 setBlanked( !isBlanked); 334 setBlanked( !isBlanked);
321} 335}
322 336
323 337
324 338
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
43class MediaPlayerDecoder; 43class MediaPlayerDecoder;
44class Config; 44class Config;
45 45
46 46
47class MediaPlayerState : public QObject { 47class MediaPlayerState : public QObject {
48Q_OBJECT 48Q_OBJECT
49public: 49public:
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
69public slots: 70public 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
103signals: 105signals:
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
121private: 124private:
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
@@ -244,367 +244,367 @@ static void null_update_frame_format( xine_vo_driver_t* self, vo_frame_t* img,
244 */ 244 */
245 if( frame->data ) { 245 if( frame->data ) {
246 if( frame->chunk[0] ){ 246 if( frame->chunk[0] ){
247 free( frame->chunk[0] ); 247 free( frame->chunk[0] );
248 frame->chunk[0] = NULL; 248 frame->chunk[0] = NULL;
249 } 249 }
250 if( frame->chunk[1] ){ 250 if( frame->chunk[1] ){
251 free ( frame->chunk[1] ); 251 free ( frame->chunk[1] );
252 frame->chunk[1] = NULL; 252 frame->chunk[1] = NULL;
253 } 253 }
254 if( frame->chunk[2] ){ 254 if( frame->chunk[2] ){
255 free ( frame->chunk[2] ); 255 free ( frame->chunk[2] );
256 frame->chunk[2] = NULL; 256 frame->chunk[2] = NULL;
257 } 257 }
258 free ( frame->data ); 258 free ( frame->data );
259 } 259 }
260 260
261 frame->data = xine_xmalloc (frame->sc.output_width 261 frame->data = xine_xmalloc (frame->sc.output_width
262 * frame->sc.output_height 262 * frame->sc.output_height
263 * this->bytes_per_pixel ); 263 * this->bytes_per_pixel );
264 264
265 if( format == XINE_IMGFMT_YV12 ) { 265 if( format == XINE_IMGFMT_YV12 ) {
266 frame->frame.pitches[0] = 8*((width + 7) / 8); 266 frame->frame.pitches[0] = 8*((width + 7) / 8);
267 frame->frame.pitches[1] = 8*((width + 15) / 16); 267 frame->frame.pitches[1] = 8*((width + 15) / 16);
268 frame->frame.pitches[2] = 8*((width + 15) / 16); 268 frame->frame.pitches[2] = 8*((width + 15) / 16);
269 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,(void **)&frame->chunk[0]); 269 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,(void **)&frame->chunk[0]);
270 frame->frame.base[1] = xine_xmalloc_aligned (16, frame->frame.pitches[1] * ((height+ 1)/2), (void **)&frame->chunk[1]); 270 frame->frame.base[1] = xine_xmalloc_aligned (16, frame->frame.pitches[1] * ((height+ 1)/2), (void **)&frame->chunk[1]);
271 frame->frame.base[2] = xine_xmalloc_aligned (16, frame->frame.pitches[2] * ((height+ 1)/2), (void **)&frame->chunk[2]); 271 frame->frame.base[2] = xine_xmalloc_aligned (16, frame->frame.pitches[2] * ((height+ 1)/2), (void **)&frame->chunk[2]);
272 272
273 }else{ 273 }else{
274 frame->frame.pitches[0] = 8*((width + 3) / 4); 274 frame->frame.pitches[0] = 8*((width + 3) / 4);
275 275
276 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height, 276 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,
277 (void **)&frame->chunk[0]); 277 (void **)&frame->chunk[0]);
278 frame->chunk[1] = NULL; 278 frame->chunk[1] = NULL;
279 frame->chunk[2] = NULL; 279 frame->chunk[2] = NULL;
280 } 280 }
281 281
282 frame->stripe_height = 16 * frame->sc.output_height / frame->sc.delivered_height; 282 frame->stripe_height = 16 * frame->sc.output_height / frame->sc.delivered_height;
283 frame->bytes_per_line = frame->sc.output_width * this->bytes_per_pixel; 283 frame->bytes_per_line = frame->sc.output_width * this->bytes_per_pixel;
284 284
285 /* 285 /*
286 * set up colorspace converter 286 * set up colorspace converter
287 */ 287 */
288 288
289 switch (flags) { 289 switch (flags) {
290 case VO_TOP_FIELD: 290 case VO_TOP_FIELD:
291 case VO_BOTTOM_FIELD: 291 case VO_BOTTOM_FIELD:
292 frame->yuv2rgb->configure (frame->yuv2rgb, 292 frame->yuv2rgb->configure (frame->yuv2rgb,
293 frame->sc.delivered_width, 293 frame->sc.delivered_width,
294 16, 294 16,
295 2*frame->frame.pitches[0], 295 2*frame->frame.pitches[0],
296 2*frame->frame.pitches[1], 296 2*frame->frame.pitches[1],
297 frame->sc.output_width, 297 frame->sc.output_width,
298 frame->stripe_height, 298 frame->stripe_height,
299 frame->bytes_per_line*2); 299 frame->bytes_per_line*2);
300 frame->yuv_stride = frame->bytes_per_line*2; 300 frame->yuv_stride = frame->bytes_per_line*2;
301 break; 301 break;
302 case VO_BOTH_FIELDS: 302 case VO_BOTH_FIELDS:
303 frame->yuv2rgb->configure (frame->yuv2rgb, 303 frame->yuv2rgb->configure (frame->yuv2rgb,
304 frame->sc.delivered_width, 304 frame->sc.delivered_width,
305 16, 305 16,
306 frame->frame.pitches[0], 306 frame->frame.pitches[0],
307 frame->frame.pitches[1], 307 frame->frame.pitches[1],
308 frame->sc.output_width, 308 frame->sc.output_width,
309 frame->stripe_height, 309 frame->stripe_height,
310 frame->bytes_per_line); 310 frame->bytes_per_line);
311 frame->yuv_stride = frame->bytes_per_line; 311 frame->yuv_stride = frame->bytes_per_line;
312 break; 312 break;
313 } 313 }
314#ifdef LOG 314#ifdef LOG
315 fprintf (stderr, "nullvideo: colorspace converter configured.\n"); 315 fprintf (stderr, "nullvideo: colorspace converter configured.\n");
316#endif 316#endif
317 } 317 }
318 318
319 /* 319 /*
320 * reset dest pointers 320 * reset dest pointers
321 */ 321 */
322 322
323 if (frame->data) { 323 if (frame->data) {
324 switch (flags) { 324 switch (flags) {
325 case VO_TOP_FIELD: 325 case VO_TOP_FIELD:
326 frame->rgb_dst = (uint8_t *)frame->data; 326 frame->rgb_dst = (uint8_t *)frame->data;
327 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; 327 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line;
328 break; 328 break;
329 case VO_BOTTOM_FIELD: 329 case VO_BOTTOM_FIELD:
330 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; 330 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ;
331 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; 331 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line;
332 break; 332 break;
333 case VO_BOTH_FIELDS: 333 case VO_BOTH_FIELDS:
334 frame->rgb_dst = (uint8_t *)frame->data; 334 frame->rgb_dst = (uint8_t *)frame->data;
335 frame->stripe_inc = frame->stripe_height * frame->bytes_per_line; 335 frame->stripe_inc = frame->stripe_height * frame->bytes_per_line;
336 break; 336 break;
337 } 337 }
338 } 338 }
339} 339}
340 340
341static void null_display_frame( xine_vo_driver_t* self, vo_frame_t *frame_gen ){ 341static void null_display_frame( xine_vo_driver_t* self, vo_frame_t *frame_gen ){
342 null_driver_t* this = (null_driver_t*) self; 342 null_driver_t* this = (null_driver_t*) self;
343 opie_frame_t* frame = (opie_frame_t*)frame_gen; 343 opie_frame_t* frame = (opie_frame_t*)frame_gen;
344 display_xine_frame_t display = this->frameDis; 344 display_xine_frame_t display = this->frameDis;
345 345
346 if (!this->m_show_video) 346 if (!this->m_show_video)
347 return; 347 return;
348 348
349 if( display != NULL ) { 349 if( display != NULL ) {
350 (*display)(this->caller, frame->data, 350 (*display)(this->caller, frame->data,
351 frame->sc.output_width, frame->sc.output_height, 351 frame->sc.output_width, frame->sc.output_height,
352 frame->bytes_per_line ); 352 frame->bytes_per_line );
353 } 353 }
354 354
355 frame->frame.displayed (&frame->frame); 355 frame->frame.displayed (&frame->frame);
356} 356}
357 357
358 358
359/* blending related */ 359/* blending related */
360static void null_overlay_clut_yuv2rgb (null_driver_t *this, 360static void null_overlay_clut_yuv2rgb (null_driver_t *this,
361 vo_overlay_t *overlay, 361 vo_overlay_t *overlay,
362 opie_frame_t *frame) { 362 opie_frame_t *frame) {
363 int i; 363 int i;
364 clut_t* clut = (clut_t*) overlay->color; 364 clut_t* clut = (clut_t*) overlay->color;
365 if (!overlay->rgb_clut) { 365 if (!overlay->rgb_clut) {
366 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { 366 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) {
367 *((uint32_t *)&clut[i]) = 367 *((uint32_t *)&clut[i]) =
368 frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb, 368 frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb,
369 clut[i].y, clut[i].cb, clut[i].cr); 369 clut[i].y, clut[i].cb, clut[i].cr);
370 } 370 }
371 overlay->rgb_clut++; 371 overlay->rgb_clut++;
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
384static void null_overlay_blend ( xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { 384static 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
421static int null_get_property( xine_vo_driver_t* self, 421static int null_get_property( xine_vo_driver_t* self,
422 int property ){ 422 int property ){
423 return 0; 423 return 0;
424} 424}
425static int null_set_property( xine_vo_driver_t* self, 425static 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}
430static void null_get_property_min_max( xine_vo_driver_t* self, 430static 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}
436static int null_gui_data_exchange( xine_vo_driver_t* self, 436static 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
442static void null_dispose ( xine_vo_driver_t* self ){ 442static 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}
446static int null_redraw_needed( xine_vo_driver_t* self ){ 446static int null_redraw_needed( xine_vo_driver_t* self ){
447 return 0; 447 return 0;
448} 448}
449 449
450 450
451xine_vo_driver_t* init_video_out_plugin( config_values_t* conf, 451xine_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
494static vo_info_t vo_info_null = { 494static vo_info_t vo_info_null = {
495 5, 495 5,
496 XINE_VISUAL_TYPE_FB 496 XINE_VISUAL_TYPE_FB
497}; 497};
498 498
499vo_info_t *get_video_out_plugin_info(){ 499vo_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 */
514int null_is_showing_video( xine_vo_driver_t* self ){ 514int 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}
518void null_set_show_video( xine_vo_driver_t* self, int show ) { 518void 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
522int null_is_fullscreen( xine_vo_driver_t* self ){ 522int 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}
525void null_set_fullscreen( xine_vo_driver_t* self, int screen ){ 525void 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}
528int null_is_scaling( xine_vo_driver_t* self ){ 528int 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
532void null_set_videoGamma( xine_vo_driver_t* self , int value ) { 532void 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
537void null_set_scaling( xine_vo_driver_t* self, int scale ) { 537void 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
541void null_set_gui_width( xine_vo_driver_t* self, int width ) { 541void 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}
544void null_set_gui_height( xine_vo_driver_t* self, int height ) { 544void 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
549void null_set_mode( xine_vo_driver_t* self, int depth, int rgb ) { 549void 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
604void null_display_handler( xine_vo_driver_t* self, display_xine_frame_t t, 604void 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
@@ -131,381 +131,380 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) {
131 setBackgroundPixmap( *pixBg ); 131 setBackgroundPixmap( *pixBg );
132 132
133 slider = new QSlider( Qt::Horizontal, this ); 133 slider = new QSlider( Qt::Horizontal, this );
134 slider->setMinValue( 0 ); 134 slider->setMinValue( 0 );
135 slider->setMaxValue( 1 ); 135 slider->setMaxValue( 1 );
136 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 136 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
137 //slider->setFocusPolicy( QWidget::NoFocus ); 137 //slider->setFocusPolicy( QWidget::NoFocus );
138 138
139 resizeEvent( NULL ); 139 resizeEvent( NULL );
140 140
141 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 141 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
142 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 142 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
143 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 143 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
144 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 144 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
145 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 145 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
146 146
147 setLength( mediaPlayerState->length() ); 147 setLength( mediaPlayerState->length() );
148 setPosition( mediaPlayerState->position() ); 148 setPosition( mediaPlayerState->position() );
149 setFullscreen( mediaPlayerState->fullscreen() ); 149 setFullscreen( mediaPlayerState->fullscreen() );
150 setPlaying( mediaPlayerState->playing() ); 150 setPlaying( mediaPlayerState->playing() );
151} 151}
152 152
153 153
154VideoWidget::~VideoWidget() { 154VideoWidget::~VideoWidget() {
155 155
156 for ( int i = 0; i < 7; i++ ) { 156 for ( int i = 0; i < 7; i++ ) {
157 delete buttonPixUp[i]; 157 delete buttonPixUp[i];
158 delete buttonPixDown[i]; 158 delete buttonPixDown[i];
159 } 159 }
160 160
161 delete pixBg; 161 delete pixBg;
162 delete imgUp; 162 delete imgUp;
163 delete imgDn; 163 delete imgDn;
164 delete imgButtonMask; 164 delete imgButtonMask;
165 for ( int i = 0; i < 7; i++ ) { 165 for ( int i = 0; i < 7; i++ ) {
166 delete masks[i]; 166 delete masks[i];
167 } 167 }
168 168
169} 169}
170 170
171QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 171QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
172 QPixmap pix( img.width(), img.height() ); 172 QPixmap pix( img.width(), img.height() );
173 QPainter p( &pix ); 173 QPainter p( &pix );
174 p.drawTiledPixmap( pix.rect(), bg, offset ); 174 p.drawTiledPixmap( pix.rect(), bg, offset );
175 p.drawImage( 0, 0, img ); 175 p.drawImage( 0, 0, img );
176 return new QPixmap( pix ); 176 return new QPixmap( pix );
177} 177}
178 178
179QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { 179QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) {
180 QPixmap *pixmap = new QPixmap( pix ); 180 QPixmap *pixmap = new QPixmap( pix );
181 pixmap->setMask( mask ); 181 pixmap->setMask( mask );
182 return pixmap; 182 return pixmap;
183} 183}
184 184
185void VideoWidget::resizeEvent( QResizeEvent * ) { 185void VideoWidget::resizeEvent( QResizeEvent * ) {
186 int h = height(); 186 int h = height();
187 int w = width(); 187 int w = width();
188 //int Vh = 160; 188 //int Vh = 160;
189 //int Vw = 220; 189 //int Vw = 220;
190 190
191 slider->setFixedWidth( w - 20 ); 191 slider->setFixedWidth( w - 20 );
192 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 192 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
193 slider->setBackgroundOrigin( QWidget::ParentOrigin ); 193 slider->setBackgroundOrigin( QWidget::ParentOrigin );
194 slider->setFocusPolicy( QWidget::NoFocus ); 194 slider->setFocusPolicy( QWidget::NoFocus );
195 slider->setBackgroundPixmap( *pixBg ); 195 slider->setBackgroundPixmap( *pixBg );
196 196
197 xoff = 0;// ( imgUp->width() ) / 2; 197 xoff = 0;// ( imgUp->width() ) / 2;
198 if(w>h) 198 if(w>h)
199 yoff = 0; 199 yoff = 0;
200 else 200 else
201 yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10; 201 yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10;
202 QPoint p( xoff, yoff ); 202 QPoint p( xoff, yoff );
203 203
204 QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); 204 QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p );
205 QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); 205 QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p );
206 206
207 for ( int i = 0; i < 7; i++ ) { 207 for ( int i = 0; i < 7; i++ ) {
208 if ( !masks[i]->isNull() ) { 208 if ( !masks[i]->isNull() ) {
209 delete buttonPixUp[i]; 209 delete buttonPixUp[i];
210 delete buttonPixDown[i]; 210 delete buttonPixDown[i];
211 buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); 211 buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] );
212 buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); 212 buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] );
213 } 213 }
214 } 214 }
215 215
216 delete pixUp; 216 delete pixUp;
217 delete pixDn; 217 delete pixDn;
218} 218}
219 219
220static bool videoSliderBeingMoved = FALSE; 220static bool videoSliderBeingMoved = FALSE;
221 221
222void VideoWidget::sliderPressed() { 222void VideoWidget::sliderPressed() {
223 videoSliderBeingMoved = TRUE; 223 videoSliderBeingMoved = TRUE;
224} 224}
225 225
226void VideoWidget::sliderReleased() { 226void VideoWidget::sliderReleased() {
227 videoSliderBeingMoved = FALSE; 227 videoSliderBeingMoved = FALSE;
228 if ( slider->width() == 0 ) { 228 if ( slider->width() == 0 ) {
229 return; 229 return;
230 } 230 }
231 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); 231 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width());
232 mediaPlayerState->setPosition( val ); 232 mediaPlayerState->setPosition( val );
233} 233}
234 234
235void VideoWidget::setPosition( long i ) { 235void VideoWidget::setPosition( long i ) {
236 updateSlider( i, mediaPlayerState->length() ); 236 updateSlider( i, mediaPlayerState->length() );
237} 237}
238 238
239 239
240void VideoWidget::setLength( long max ) { 240void VideoWidget::setLength( long max ) {
241 updateSlider( mediaPlayerState->position(), max ); 241 updateSlider( mediaPlayerState->position(), max );
242} 242}
243 243
244void VideoWidget::setView( char view ) { 244void VideoWidget::setView( char view ) {
245 245
246 if ( view == 'v' ) { 246 if ( view == 'v' ) {
247 makeVisible(); 247 makeVisible();
248 } else { 248 } else {
249 // Effectively blank the view next time we show it so it looks nicer 249 // Effectively blank the view next time we show it so it looks nicer
250 scaledWidth = 0; 250 scaledWidth = 0;
251 scaledHeight = 0; 251 scaledHeight = 0;
252 hide(); 252 hide();
253 } 253 }
254} 254}
255 255
256void VideoWidget::updateSlider( long i, long max ) { 256void VideoWidget::updateSlider( long i, long max ) {
257 // Will flicker too much if we don't do this 257 // Will flicker too much if we don't do this
258 if ( max == 0 ) { 258 if ( max == 0 ) {
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
273void VideoWidget::setToggleButton( int i, bool down ) { 273void 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
279void VideoWidget::toggleButton( int i ) { 279void 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
285void VideoWidget::paintButton( QPainter *p, int i ) { 285void 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
294void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 294void 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
357void VideoWidget::mousePressEvent( QMouseEvent *event ) { 357void VideoWidget::mousePressEvent( QMouseEvent *event ) {
358 mouseMoveEvent( event ); 358 mouseMoveEvent( event );
359} 359}
360 360
361void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 361void 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
369void VideoWidget::showEvent( QShowEvent* ) { 369void 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
380void VideoWidget::makeVisible() { 380void 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
416void VideoWidget::paintEvent( QPaintEvent * pe) { 415void 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
444void VideoWidget::closeEvent( QCloseEvent* ) { 443void VideoWidget::closeEvent( QCloseEvent* ) {
445 mediaPlayerState->setList(); 444 mediaPlayerState->setList();
446} 445}
447 446
448 447
449 448
450void VideoWidget::keyReleaseEvent( QKeyEvent *e) { 449void 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
498XineVideoWidget* VideoWidget::vidWidget() { 497XineVideoWidget* VideoWidget::vidWidget() {
499 return videoFrame; 498 return videoFrame;
500} 499}
501 500
502 501
503void VideoWidget::setFullscreen ( bool b ) { 502void VideoWidget::setFullscreen ( bool b ) {
504 setToggleButton( VideoFullscreen, b ); 503 setToggleButton( VideoFullscreen, b );
505} 504}
506 505
507 506
508void VideoWidget::setPlaying( bool b) { 507void 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,258 +1,259 @@
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
43extern MediaPlayerState *mediaPlayerState; 43extern MediaPlayerState *mediaPlayerState;
44extern VideoWidget *videoUI; 44extern VideoWidget *videoUI;
45XineControl::XineControl( QObject *parent, const char *name ) 45XineControl::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
62XineControl::~XineControl() { 62XineControl::~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
73void XineControl::play( const QString& fileName ) { 73void 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
119void XineControl::nextMedia() { 120void XineControl::nextMedia() {
120 mediaPlayerState->setNext(); 121 mediaPlayerState->setNext();
121} 122}
122 123
123void XineControl::setGamma( int value ) { 124void XineControl::setGamma( int value ) {
124 libXine->setGamma( value ); 125 libXine->setGamma( value );
125} 126}
126 127
127void XineControl::stop( bool isSet ) { 128void 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 */
145void XineControl::pause( bool isSet) { 146void 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 */
157long XineControl::currentTime() { 158long 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 */
167void XineControl::length() { 168void 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 */
177long XineControl::position() { 178long 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 */
194void XineControl::setFullscreen( bool isSet ) { 195void XineControl::setFullscreen( bool isSet ) {
195 libXine->showVideoFullScreen( isSet ); 196 libXine->showVideoFullScreen( isSet );
196} 197}
197 198
198 199
199QString XineControl::getMetaInfo() { 200QString 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
229QString XineControl::getErrorCode() { 230QString XineControl::getErrorCode() {
230 231
231 int errorCode = libXine->error(); 232 int errorCode = libXine->error();
232 233
233 qDebug( QString("ERRORCODE: %1 ").arg(errorCode) ); 234 qDebug( QString("ERRORCODE: %1 ").arg(errorCode) );
234 235
235 if ( errorCode == 1 ) { 236 if ( errorCode == 1 ) {
236 return tr( "No input plugin found for this media type" ); 237 return tr( "No input plugin found for this media type" );
237 } else if ( errorCode == 2 ) { 238 } else if ( errorCode == 2 ) {
238 return tr( "No demux plugin found for this media type" ); 239 return tr( "No demux plugin found for this media type" );
239 } else if ( errorCode == 3 ) { 240 } else if ( errorCode == 3 ) {
240 return tr( "Demuxing failed for this media type" ); 241 return tr( "Demuxing failed for this media type" );
241 } else if ( errorCode == 4 ) { 242 } else if ( errorCode == 4 ) {
242 return tr( "Malformed MRL" ); 243 return tr( "Malformed MRL" );
243 } else { 244 } else {
244 return tr( "Some other error" ); 245 return tr( "Some other error" );
245 } 246 }
246} 247}
247 248
248/** 249/**
249 * Seek to a position in the track 250 * Seek to a position in the track
250 * @param second the second to jump to 251 * @param second the second to jump to
251 */ 252 */
252void XineControl::seekTo( long second ) { 253void XineControl::seekTo( long second ) {
253 libXine->seekTo( (int)second ); 254 libXine->seekTo( (int)second );
254} 255}
255 256
256void XineControl::videoResized ( const QSize &s ) { 257void XineControl::videoResized ( const QSize &s ) {
257 libXine->resize( s ); 258 libXine->resize( s );
258} 259}