summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp8
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h5
-rw-r--r--noncore/multimedia/opieplayer2/inputDialog.cpp8
-rw-r--r--noncore/multimedia/opieplayer2/inputDialog.h5
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/volumecontrol.cpp15
-rw-r--r--noncore/multimedia/opieplayer2/volumecontrol.h2
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h10
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp7
12 files changed, 45 insertions, 29 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 40e20e1..a718826 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -144,50 +144,50 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
144 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 144 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
145 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 145 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
146 146
147 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); 147 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
148 imgButtonMask->fill( 0 ); 148 imgButtonMask->fill( 0 );
149 149
150 for ( int i = 0; i < 10; i++ ) { 150 for ( int i = 0; i < 10; i++ ) {
151 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); 151 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" );
152 masks[i] = new QBitmap( filename ); 152 masks[i] = new QBitmap( filename );
153 153
154 if ( !masks[i]->isNull() ) { 154 if ( !masks[i]->isNull() ) {
155 QImage imgMask = masks[i]->convertToImage(); 155 QImage imgMask = masks[i]->convertToImage();
156 uchar **dest = imgButtonMask->jumpTable(); 156 uchar **dest = imgButtonMask->jumpTable();
157 for ( int y = 0; y < imgUp->height(); y++ ) { 157 for ( int y = 0; y < imgUp->height(); y++ ) {
158 uchar *line = dest[y]; 158 uchar *line = dest[y];
159 for ( int x = 0; x < imgUp->width(); x++ ) 159 for ( int x = 0; x < imgUp->width(); x++ )
160 if ( !qRed( imgMask.pixel( x, y ) ) ) 160 if ( !qRed( imgMask.pixel( x, y ) ) )
161 line[x] = i + 1; 161 line[x] = i + 1;
162 } 162 }
163 } 163 }
164 164
165 } 165 }
166 166
167 for ( int i = 0; i < 10; i++ ) { 167 for ( int i = 0; i < 10; i++ ) {
168 buttonPixUp[i] = NULL; 168 buttonPixUp[i] = 0l;
169 buttonPixDown[i] = NULL; 169 buttonPixDown[i] = 0l;
170 } 170 }
171 171
172 setBackgroundPixmap( *pixBg ); 172 setBackgroundPixmap( *pixBg );
173 173
174 songInfo.setFocusPolicy( QWidget::NoFocus ); 174 songInfo.setFocusPolicy( QWidget::NoFocus );
175 changeTextColor( &songInfo ); 175 changeTextColor( &songInfo );
176 176
177 slider.setFixedHeight( 20 ); 177 slider.setFixedHeight( 20 );
178 slider.setMinValue( 0 ); 178 slider.setMinValue( 0 );
179 slider.setMaxValue( 1 ); 179 slider.setMaxValue( 1 );
180 slider.setFocusPolicy( QWidget::NoFocus ); 180 slider.setFocusPolicy( QWidget::NoFocus );
181 slider.setBackgroundPixmap( *pixBg ); 181 slider.setBackgroundPixmap( *pixBg );
182 182
183 time.setFocusPolicy( QWidget::NoFocus ); 183 time.setFocusPolicy( QWidget::NoFocus );
184 time.setAlignment( Qt::AlignCenter ); 184 time.setAlignment( Qt::AlignCenter );
185 time.setFrame(FALSE); 185 time.setFrame(FALSE);
186 changeTextColor( &time ); 186 changeTextColor( &time );
187 187
188 resizeEvent( NULL ); 188 resizeEvent( NULL );
189 189
190 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 190 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
191 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 191 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
192 192
193 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 193 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
@@ -206,64 +206,66 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
206 // Intialise state 206 // Intialise state
207 setLength( mediaPlayerState->length() ); 207 setLength( mediaPlayerState->length() );
208 setPosition( mediaPlayerState->position() ); 208 setPosition( mediaPlayerState->position() );
209 setLooping( mediaPlayerState->fullscreen() ); 209 setLooping( mediaPlayerState->fullscreen() );
210 // setPaused( mediaPlayerState->paused() ); 210 // setPaused( mediaPlayerState->paused() );
211 setPlaying( mediaPlayerState->playing() ); 211 setPlaying( mediaPlayerState->playing() );
212 212
213} 213}
214 214
215AudioWidget::~AudioWidget() { 215AudioWidget::~AudioWidget() {
216 216
217 for ( int i = 0; i < 10; i++ ) { 217 for ( int i = 0; i < 10; i++ ) {
218 delete buttonPixUp[i]; 218 delete buttonPixUp[i];
219 delete buttonPixDown[i]; 219 delete buttonPixDown[i];
220 } 220 }
221 delete pixBg; 221 delete pixBg;
222 delete imgUp; 222 delete imgUp;
223 delete imgDn; 223 delete imgDn;
224 delete imgButtonMask; 224 delete imgButtonMask;
225 for ( int i = 0; i < 10; i++ ) { 225 for ( int i = 0; i < 10; i++ ) {
226 delete masks[i]; 226 delete masks[i];
227 } 227 }
228} 228}
229 229
230namespace {
231
230QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 232QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
231 QPixmap pix( img.width(), img.height() ); 233 QPixmap pix( img.width(), img.height() );
232 QPainter p( &pix ); 234 QPainter p( &pix );
233 p.drawTiledPixmap( pix.rect(), bg, offset ); 235 p.drawTiledPixmap( pix.rect(), bg, offset );
234 p.drawImage( 0, 0, img ); 236 p.drawImage( 0, 0, img );
235 return new QPixmap( pix ); 237 return new QPixmap( pix );
236} 238}
237 239
238 240
239QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) { 241QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) {
240 QPixmap *pixmap = new QPixmap( pix ); 242 QPixmap *pixmap = new QPixmap( pix );
241 pixmap->setMask( mask ); 243 pixmap->setMask( mask );
242 return pixmap; 244 return pixmap;
243} 245}
244 246
245 247};
246 248
247void AudioWidget::resizeEvent( QResizeEvent * ) { 249void AudioWidget::resizeEvent( QResizeEvent * ) {
248 int h = height(); 250 int h = height();
249 int w = width(); 251 int w = width();
250 252
251 songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); 253 songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) );
252 slider.setFixedWidth( w - 110 ); 254 slider.setFixedWidth( w - 110 );
253 slider.setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); 255 slider.setGeometry( QRect( 15, h - 30, w - 90, 20 ) );
254 slider.setBackgroundOrigin( QWidget::ParentOrigin ); 256 slider.setBackgroundOrigin( QWidget::ParentOrigin );
255 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); 257 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
256 258
257 xoff = ( w - imgUp->width() ) / 2; 259 xoff = ( w - imgUp->width() ) / 2;
258 yoff = (( h - imgUp->height() ) / 2) - 10; 260 yoff = (( h - imgUp->height() ) / 2) - 10;
259 QPoint p( xoff, yoff ); 261 QPoint p( xoff, yoff );
260 262
261 QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p ); 263 QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p );
262 QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p ); 264 QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p );
263 265
264 for ( int i = 0; i < 10; i++ ) { 266 for ( int i = 0; i < 10; i++ ) {
265 if ( !masks[i]->isNull() ) { 267 if ( !masks[i]->isNull() ) {
266 delete buttonPixUp[i]; 268 delete buttonPixUp[i];
267 delete buttonPixDown[i]; 269 delete buttonPixDown[i];
268 buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] ); 270 buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] );
269 buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] ); 271 buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] );
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 626004a..c544882 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -25,61 +25,63 @@
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 {
50
49enum AudioButtons { 51enum AudioButtons {
50 AudioPlay=0, 52 AudioPlay=0,
51 AudioStop, 53 AudioStop,
52 AudioNext, 54 AudioNext,
53 AudioPrevious, 55 AudioPrevious,
54 AudioVolumeUp, 56 AudioVolumeUp,
55 AudioVolumeDown, 57 AudioVolumeDown,
56 AudioLoop, 58 AudioLoop,
57 AudioPlayList, 59 AudioPlayList,
58 AudioForward, 60 AudioForward,
59 AudioBack 61 AudioBack
60}; 62};
61 63};
62 64
63class Ticker : public QFrame { 65class Ticker : public QFrame {
64 Q_OBJECT 66 Q_OBJECT
65 67
66public: 68public:
67 Ticker( QWidget* parent=0 ); 69 Ticker( QWidget* parent=0 );
68 ~Ticker(); 70 ~Ticker();
69 void setText( const QString& text ) ; 71 void setText( const QString& text ) ;
70 72
71protected: 73protected:
72 void timerEvent( QTimerEvent * ); 74 void timerEvent( QTimerEvent * );
73 void drawContents( QPainter *p ); 75 void drawContents( QPainter *p );
74private: 76private:
75 QString scrollText; 77 QString scrollText;
76 int pos, pixelLen; 78 int pos, pixelLen;
77}; 79};
78 80
79 81
80class AudioWidget : public QWidget { 82class AudioWidget : public QWidget {
81 Q_OBJECT 83 Q_OBJECT
82public: 84public:
83 AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); 85 AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 );
84 ~AudioWidget(); 86 ~AudioWidget();
85 void setTickerText( const QString &text ) { songInfo.setText( text ); } 87 void setTickerText( const QString &text ) { songInfo.setText( text ); }
@@ -119,29 +121,30 @@ protected:
119 void keyReleaseEvent( QKeyEvent *e); 121 void keyReleaseEvent( QKeyEvent *e);
120private slots: 122private slots:
121 void skipFor(); 123 void skipFor();
122 void skipBack(); 124 void skipBack();
123 void stopSkip(); 125 void stopSkip();
124private: 126private:
125 void toggleButton( int ); 127 void toggleButton( int );
126 void setToggleButton( int, bool ); 128 void setToggleButton( int, bool );
127 void paintButton( QPainter *p, int i ); 129 void paintButton( QPainter *p, int i );
128 int skipDirection; 130 int skipDirection;
129 QString skin; 131 QString skin;
130 QPixmap *pixBg; 132 QPixmap *pixBg;
131 QImage *imgUp; 133 QImage *imgUp;
132 QImage *imgDn; 134 QImage *imgDn;
133 QImage *imgButtonMask; 135 QImage *imgButtonMask;
134 QBitmap *masks[10]; 136 QBitmap *masks[10];
135 QPixmap *buttonPixUp[10]; 137 QPixmap *buttonPixUp[10];
136 QPixmap *buttonPixDown[10]; 138 QPixmap *buttonPixDown[10];
137 139
138 QPixmap *pixmaps[4]; 140 QPixmap *pixmaps[4];
139 Ticker songInfo; 141 Ticker songInfo;
140 QSlider slider; 142 QSlider slider;
141 QLineEdit time; 143 QLineEdit time;
142 int xoff, yoff; 144 int xoff, yoff;
145 bool isStreaming : 1;
143}; 146};
144 147
145 148
146#endif // AUDIO_WIDGET_H 149#endif // AUDIO_WIDGET_H
147 150
diff --git a/noncore/multimedia/opieplayer2/inputDialog.cpp b/noncore/multimedia/opieplayer2/inputDialog.cpp
index c13ea63..9edb1d3 100644
--- a/noncore/multimedia/opieplayer2/inputDialog.cpp
+++ b/noncore/multimedia/opieplayer2/inputDialog.cpp
@@ -5,53 +5,57 @@
5#include <opie/ofiledialog.h> 5#include <opie/ofiledialog.h>
6 6
7#include <qlineedit.h> 7#include <qlineedit.h>
8#include <qlayout.h> 8#include <qlayout.h>
9#include <qvariant.h> 9#include <qvariant.h>
10#include <qpushbutton.h> 10#include <qpushbutton.h>
11#include <qwhatsthis.h> 11#include <qwhatsthis.h>
12 12
13InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 13InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
14 : QDialog( parent, name, modal, fl ) { 14 : QDialog( parent, name, modal, fl ) {
15 if ( !name ) { 15 if ( !name ) {
16 setName( "InputDialog" ); 16 setName( "InputDialog" );
17 } 17 }
18 resize( 234, 115); 18 resize( 234, 115);
19 setMaximumSize( QSize( 240, 40)); 19 setMaximumSize( QSize( 240, 40));
20 setCaption( tr( name ) ); 20 setCaption( tr( name ) );
21 21
22 QPushButton *browserButton; 22 QPushButton *browserButton;
23 browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); 23 browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton");
24 browserButton->setGeometry( QRect( 205, 10, 22, 22)); 24 browserButton->setGeometry( QRect( 205, 10, 22, 22));
25 connect( browserButton, SIGNAL(released()),this,SLOT(browse())); 25 connect( browserButton, SIGNAL(released()),this,SLOT(browse()));
26 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 26 LineEdit1 = new QLineEdit( this, "LineEdit1" );
27 LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); 27 LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) );
28} 28}
29 29/*
30 * return the current text(input)
31 */
32QString InputDialog::text() const {
33 return LineEdit1->text();
34}
30/* 35/*
31 * Destroys the object and frees any allocated resources 36 * Destroys the object and frees any allocated resources
32 */ 37 */
33InputDialog::~InputDialog() { 38InputDialog::~InputDialog() {
34 inputText= LineEdit1->text();
35} 39}
36 40
37void InputDialog::browse() { 41void InputDialog::browse() {
38 42
39 MimeTypes types; 43 MimeTypes types;
40 QStringList audio, video, all; 44 QStringList audio, video, all;
41 audio << "audio/*"; 45 audio << "audio/*";
42 audio << "playlist/plain"; 46 audio << "playlist/plain";
43 audio << "audio/x-mpegurl"; 47 audio << "audio/x-mpegurl";
44 48
45 video << "video/*"; 49 video << "video/*";
46 video << "playlist/plain"; 50 video << "playlist/plain";
47 51
48 all += audio; 52 all += audio;
49 all += video; 53 all += video;
50 types.insert("All Media Files", all ); 54 types.insert("All Media Files", all );
51 types.insert("Audio", audio ); 55 types.insert("Audio", audio );
52 types.insert("Video", video ); 56 types.insert("Video", video );
53 57
54 QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); 58 QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 );
55 LineEdit1->setText(str); 59 LineEdit1->setText(str);
56} 60}
57 61
diff --git a/noncore/multimedia/opieplayer2/inputDialog.h b/noncore/multimedia/opieplayer2/inputDialog.h
index d4f5e12..0f36ea4 100644
--- a/noncore/multimedia/opieplayer2/inputDialog.h
+++ b/noncore/multimedia/opieplayer2/inputDialog.h
@@ -1,22 +1,25 @@
1 1
2#ifndef INPUTDIALOG_H 2#ifndef INPUTDIALOG_H
3#define INPUTDIALOG_H 3#define INPUTDIALOG_H
4 4
5#include <qvariant.h> 5#include <qvariant.h>
6#include <qdialog.h> 6#include <qdialog.h>
7 7
8class QLineEdit; 8class QLineEdit;
9 9
10class InputDialog : public QDialog { 10class InputDialog : public QDialog {
11 Q_OBJECT 11 Q_OBJECT
12 12
13public: 13public:
14 InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 14 InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
15 ~InputDialog(); 15 ~InputDialog();
16 QString inputText; 16 QString text()const;
17
18private:
17 QLineEdit* LineEdit1; 19 QLineEdit* LineEdit1;
20
18protected slots: 21protected slots:
19 void browse(); 22 void browse();
20}; 23};
21 24
22#endif // INPUTDIALOG_H 25#endif // INPUTDIALOG_H
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 18caaad..0f8242b 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -159,50 +159,50 @@ void MediaPlayer::stopChangingVolume() {
159 onScreenDisplayVolume = 0; 159 onScreenDisplayVolume = 0;
160 int w=0; 160 int w=0;
161 int h=0; 161 int h=0;
162 if( !xineControl->hasVideo()) { 162 if( !xineControl->hasVideo()) {
163 w = audioUI->width(); 163 w = audioUI->width();
164 h = audioUI->height(); 164 h = audioUI->height();
165 audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); 165 audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE );
166 } else { 166 } else {
167 w = videoUI->width(); 167 w = videoUI->width();
168 h = videoUI->height(); 168 h = videoUI->height();
169 videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); 169 videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE );
170 } 170 }
171} 171}
172 172
173 173
174void MediaPlayer::timerEvent( QTimerEvent * ) { 174void MediaPlayer::timerEvent( QTimerEvent * ) {
175 if ( volumeDirection == +1 ) { 175 if ( volumeDirection == +1 ) {
176 volControl->incVol(2); 176 volControl->incVol(2);
177 } else if ( volumeDirection == -1 ) { 177 } else if ( volumeDirection == -1 ) {
178 volControl->decVol(2); 178 volControl->decVol(2);
179 } 179 }
180 180
181 181
182 // TODO FIXME 182 // TODO FIXME
183 unsigned int v; 183 unsigned int v= 0;
184 v = volControl->getVolume(); 184 v = volControl->volume();
185 v = v / 10; 185 v = v / 10;
186 186
187 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { 187 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) {
188 return; 188 return;
189 } 189 }
190 190
191 int w=0; int h=0; 191 int w=0; int h=0;
192 if( !xineControl->hasVideo()) { 192 if( !xineControl->hasVideo()) {
193 w = audioUI->width(); 193 w = audioUI->width();
194 h = audioUI->height(); 194 h = audioUI->height();
195 195
196 if ( drawnOnScreenDisplay ) { 196 if ( drawnOnScreenDisplay ) {
197 if ( onScreenDisplayVolume > v ) { 197 if ( onScreenDisplayVolume > v ) {
198 audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); 198 audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE );
199 } 199 }
200 } 200 }
201 drawnOnScreenDisplay = TRUE; 201 drawnOnScreenDisplay = TRUE;
202 onScreenDisplayVolume = v; 202 onScreenDisplayVolume = v;
203 QPainter p( audioUI ); 203 QPainter p( audioUI );
204 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 204 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
205 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 205 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
206 206
207 QFont f; 207 QFont f;
208 f.setPixelSize( 20 ); 208 f.setPixelSize( 20 );
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index 8366ab4..eaedaa5 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -1,43 +1,43 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <qpe/qlibrary.h> 2#include <qpe/qlibrary.h>
3#include <qpe/config.h> 3#include <qpe/config.h>
4#include <qvaluelist.h> 4#include <qvaluelist.h>
5#include <qobject.h> 5#include <qobject.h>
6#include <qdir.h> 6#include <qdir.h>
7#include "mediaplayerstate.h" 7#include "mediaplayerstate.h"
8 8
9 9
10 10
11//#define MediaPlayerDebug(x) qDebug x 11//#define MediaPlayerDebug(x) qDebug x
12#define MediaPlayerDebug(x) 12#define MediaPlayerDebug(x)
13 13
14 14
15MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) 15MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
16 : QObject( parent, name ) { 16 : QObject( parent, name ) {
17 Config cfg( "OpiePlayer" ); 17 Config cfg( "OpiePlayer" );
18 readConfig( cfg ); 18 readConfig( cfg );
19 19 isStreaming = false;
20} 20}
21 21
22 22
23MediaPlayerState::~MediaPlayerState() { 23MediaPlayerState::~MediaPlayerState() {
24 Config cfg( "OpiePlayer" ); 24 Config cfg( "OpiePlayer" );
25 writeConfig( cfg ); 25 writeConfig( cfg );
26 26
27} 27}
28 28
29 29
30void MediaPlayerState::readConfig( Config& cfg ) { 30void MediaPlayerState::readConfig( Config& cfg ) {
31 cfg.setGroup("Options"); 31 cfg.setGroup("Options");
32 isFullscreen = cfg.readBoolEntry( "FullScreen" ); 32 isFullscreen = cfg.readBoolEntry( "FullScreen" );
33 isScaled = cfg.readBoolEntry( "Scaling" ); 33 isScaled = cfg.readBoolEntry( "Scaling" );
34 isLooping = cfg.readBoolEntry( "Looping" ); 34 isLooping = cfg.readBoolEntry( "Looping" );
35 isShuffled = cfg.readBoolEntry( "Shuffle" ); 35 isShuffled = cfg.readBoolEntry( "Shuffle" );
36 usePlaylist = cfg.readBoolEntry( "UsePlayList" ); 36 usePlaylist = cfg.readBoolEntry( "UsePlayList" );
37 usePlaylist = TRUE; 37 usePlaylist = TRUE;
38 isPlaying = FALSE; 38 isPlaying = FALSE;
39 isStreaming = FALSE; 39 isStreaming = FALSE;
40 isPaused = FALSE; 40 isPaused = FALSE;
41 curPosition = 0; 41 curPosition = 0;
42 curLength = 0; 42 curLength = 0;
43 curView = 'l'; 43 curView = 'l';
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 10f1792..251c2e5 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -568,49 +568,49 @@ bool PlayListWidget::first() {
568 if ( mediaPlayerState->playlist() ) 568 if ( mediaPlayerState->playlist() )
569 return d->selectedFiles->first(); 569 return d->selectedFiles->first();
570 else 570 else
571 return mediaPlayerState->looping(); 571 return mediaPlayerState->looping();
572} 572}
573 573
574 574
575bool PlayListWidget::last() { 575bool PlayListWidget::last() {
576 if ( mediaPlayerState->playlist() ) 576 if ( mediaPlayerState->playlist() )
577 return d->selectedFiles->last(); 577 return d->selectedFiles->last();
578 else 578 else
579 return mediaPlayerState->looping(); 579 return mediaPlayerState->looping();
580} 580}
581 581
582 582
583void PlayListWidget::saveList() { 583void PlayListWidget::saveList() {
584 584
585 QString filename; 585 QString filename;
586 InputDialog *fileDlg = 0l; 586 InputDialog *fileDlg = 0l;
587 fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0); 587 fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0);
588 fileDlg->exec(); 588 fileDlg->exec();
589 if( fileDlg->result() == 1 ) { 589 if( fileDlg->result() == 1 ) {
590 if ( d->current ) 590 if ( d->current )
591 delete d->current; 591 delete d->current;
592 filename = fileDlg->LineEdit1->text();//+".playlist"; 592 filename = fileDlg->text();//+".playlist";
593 // qDebug("saving playlist "+filename+".playlist"); 593 // qDebug("saving playlist "+filename+".playlist");
594 Config cfg( filename +".playlist"); 594 Config cfg( filename +".playlist");
595 writeConfig( cfg ); 595 writeConfig( cfg );
596 596
597 DocLnk lnk; 597 DocLnk lnk;
598 lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property 598 lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property
599 lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D 599 lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D
600 lnk.setIcon("opieplayer2/playlist2"); 600 lnk.setIcon("opieplayer2/playlist2");
601 lnk.setName( filename); //sets file name 601 lnk.setName( filename); //sets file name
602 // qDebug(filename); 602 // qDebug(filename);
603 if(!lnk.writeLink()) { 603 if(!lnk.writeLink()) {
604 qDebug("Writing doclink did not work"); 604 qDebug("Writing doclink did not work");
605 } 605 }
606 } 606 }
607 Config config( "OpiePlayer" ); 607 Config config( "OpiePlayer" );
608 config.writeEntry("CurrentPlaylist",filename); 608 config.writeEntry("CurrentPlaylist",filename);
609 setCaption(tr("OpiePlayer: ")+filename); 609 setCaption(tr("OpiePlayer: ")+filename);
610 d->selectedFiles->first(); 610 d->selectedFiles->first();
611 if(fileDlg) { 611 if(fileDlg) {
612 delete fileDlg; 612 delete fileDlg;
613 } 613 }
614} 614}
615 615
616void PlayListWidget::loadList( const DocLnk & lnk) { 616void PlayListWidget::loadList( const DocLnk & lnk) {
@@ -927,49 +927,49 @@ void PlayListWidget::populateVideoView() {
927 videoView->clear(); 927 videoView->clear();
928 QString storage; 928 QString storage;
929 for ( ; Vdit.current(); ++Vdit ) { 929 for ( ; Vdit.current(); ++Vdit ) {
930 for( ; it.current(); ++it ){ 930 for( ; it.current(); ++it ){
931 const QString name = (*it)->name(); 931 const QString name = (*it)->name();
932 const QString path = (*it)->path(); 932 const QString path = (*it)->path();
933 if( Vdit.current()->file().find(path) != -1 ) storage=name; 933 if( Vdit.current()->file().find(path) != -1 ) storage=name;
934 } 934 }
935 935
936 QListViewItem * newItem; 936 QListViewItem * newItem;
937 if ( QFile( Vdit.current()->file()).exists() ) { 937 if ( QFile( Vdit.current()->file()).exists() ) {
938 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 938 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
939 QString::number( QFile( Vdit.current()->file()).size() ), storage); 939 QString::number( QFile( Vdit.current()->file()).size() ), storage);
940 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" )); 940 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ));
941 } 941 }
942 } 942 }
943} 943}
944 944
945void PlayListWidget::openFile() { 945void PlayListWidget::openFile() {
946 QString filename, name; 946 QString filename, name;
947 InputDialog *fileDlg; 947 InputDialog *fileDlg;
948 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 948 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
949 fileDlg->exec(); 949 fileDlg->exec();
950 if( fileDlg->result() == 1 ) { 950 if( fileDlg->result() == 1 ) {
951 filename = fileDlg->LineEdit1->text(); 951 filename = fileDlg->text();
952 952
953 qDebug("Selected filename is "+filename); 953 qDebug("Selected filename is "+filename);
954 if(filename.right(3) == "m3u") { 954 if(filename.right(3) == "m3u") {
955 readm3u( filename ); 955 readm3u( filename );
956 } else if(filename.right(3) == "pls") { 956 } else if(filename.right(3) == "pls") {
957 readPls( filename ); 957 readPls( filename );
958 } else { 958 } else {
959 DocLnk lnk; 959 DocLnk lnk;
960 960
961 lnk.setName(filename); //sets file name 961 lnk.setName(filename); //sets file name
962 lnk.setFile(filename); //sets File property 962 lnk.setFile(filename); //sets File property
963 lnk.setType("audio/x-mpegurl"); 963 lnk.setType("audio/x-mpegurl");
964 lnk.setExec("opieplayer"); 964 lnk.setExec("opieplayer");
965 lnk.setIcon("opieplayer2/MPEGPlayer"); 965 lnk.setIcon("opieplayer2/MPEGPlayer");
966 966
967 if(!lnk.writeLink()) { 967 if(!lnk.writeLink()) {
968 qDebug("Writing doclink did not work"); 968 qDebug("Writing doclink did not work");
969 } 969 }
970 d->selectedFiles->addToSelection( lnk); 970 d->selectedFiles->addToSelection( lnk);
971 } 971 }
972 } 972 }
973 if(fileDlg) { 973 if(fileDlg) {
974 delete fileDlg; 974 delete fileDlg;
975 } 975 }
@@ -1102,49 +1102,49 @@ void PlayListWidget::readm3u(const QString &filename) {
1102 if(s.at(s.length()-4) == '.') { 1102 if(s.at(s.length()-4) == '.') {
1103 lnk.setFile( s); 1103 lnk.setFile( s);
1104 } else { 1104 } else {
1105 lnk.setFile( s+"/"); 1105 lnk.setFile( s+"/");
1106 } 1106 }
1107 lnk.setType("audio/x-mpegurl"); 1107 lnk.setType("audio/x-mpegurl");
1108 lnk.writeLink(); 1108 lnk.writeLink();
1109 d->selectedFiles->addToSelection( lnk); 1109 d->selectedFiles->addToSelection( lnk);
1110 } 1110 }
1111 i++; 1111 i++;
1112 } 1112 }
1113 } 1113 }
1114 } 1114 }
1115 } 1115 }
1116 f.close(); 1116 f.close();
1117} 1117}
1118 1118
1119void PlayListWidget::writem3u() { 1119void PlayListWidget::writem3u() {
1120 1120
1121 InputDialog *fileDlg; 1121 InputDialog *fileDlg;
1122 fileDlg = new InputDialog(this,tr("Save m3u Playlist "),TRUE, 0); 1122 fileDlg = new InputDialog(this,tr("Save m3u Playlist "),TRUE, 0);
1123 fileDlg->exec(); 1123 fileDlg->exec();
1124 QString filename,list; 1124 QString filename,list;
1125 if( fileDlg->result() == 1 ) { 1125 if( fileDlg->result() == 1 ) {
1126 filename = fileDlg->LineEdit1->text(); 1126 filename = fileDlg->text();
1127 qDebug(filename); 1127 qDebug(filename);
1128 int noOfFiles = 0; 1128 int noOfFiles = 0;
1129 d->selectedFiles->first(); 1129 d->selectedFiles->first();
1130 do { 1130 do {
1131 // we dont check for existance because of url's 1131 // we dont check for existance because of url's
1132 // qDebug(d->selectedFiles->current()->file()); 1132 // qDebug(d->selectedFiles->current()->file());
1133 list += d->selectedFiles->current()->file()+"\n"; 1133 list += d->selectedFiles->current()->file()+"\n";
1134 noOfFiles++; 1134 noOfFiles++;
1135 } 1135 }
1136 while ( d->selectedFiles->next() ); 1136 while ( d->selectedFiles->next() );
1137 qDebug(list); 1137 qDebug(list);
1138 if(filename.left(1) != "/") 1138 if(filename.left(1) != "/")
1139 filename=QPEApplication::documentDir()+"/"+filename; 1139 filename=QPEApplication::documentDir()+"/"+filename;
1140 if(filename.right(3) != "m3u") 1140 if(filename.right(3) != "m3u")
1141 filename=filename+".m3u"; 1141 filename=filename+".m3u";
1142 1142
1143 QFile f(filename); 1143 QFile f(filename);
1144 f.open(IO_WriteOnly); 1144 f.open(IO_WriteOnly);
1145 f.writeBlock(list, list.length()); 1145 f.writeBlock(list, list.length());
1146 f.close(); 1146 f.close();
1147 } 1147 }
1148 if(fileDlg) delete fileDlg; 1148 if(fileDlg) delete fileDlg;
1149} 1149}
1150 1150
diff --git a/noncore/multimedia/opieplayer2/volumecontrol.cpp b/noncore/multimedia/opieplayer2/volumecontrol.cpp
index a795f3b..271b84e 100644
--- a/noncore/multimedia/opieplayer2/volumecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/volumecontrol.cpp
@@ -1,62 +1,61 @@
1 1
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include <qpe/config.h> 3#include <qpe/config.h>
4#include "qpe/qcopenvelope_qws.h" 4#include "qpe/qcopenvelope_qws.h"
5#include <qmessagebox.h> 5#include <qmessagebox.h>
6 6
7#include "volumecontrol.h" 7#include "volumecontrol.h"
8 8
9int VolumeControl::getVolume() { 9int VolumeControl::volume() {
10 int volumePerc;
11 Config cfg( "qpe" ); 10 Config cfg( "qpe" );
12 cfg. setGroup( "Volume" ); 11 cfg. setGroup( "Volume" );
13 volumePerc = cfg. readNumEntry( "VolumePercent", 50 ); 12 m_volumePerc = cfg. readNumEntry( "VolumePercent", 50 );
14 m_volumePerc = volumePerc; 13
15 return volumePerc; 14 return m_volumePerc;
16} 15}
17 16
18 17
19void VolumeControl::setVolume( int volumePerc ) { 18void VolumeControl::setVolume( int volumePerc ) {
20 Config cfg("qpe"); 19 Config cfg("qpe");
21 cfg.setGroup("Volume"); 20 cfg.setGroup("Volume");
22 21
23 if ( volumePerc > 100 ) { 22 if ( volumePerc > 100 ) {
24 volumePerc = 100; 23 volumePerc = 100;
25 } 24 }
26 if ( volumePerc < 0 ) { 25 if ( volumePerc < 0 ) {
27 volumePerc = 0; 26 volumePerc = 0;
28 } 27 }
29 28
30 m_volumePerc = volumePerc; 29 m_volumePerc = volumePerc;
31 cfg.writeEntry("VolumePercent", volumePerc ); 30 cfg.writeEntry("VolumePercent", volumePerc );
32 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; 31 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false;
33// QCopEnvelope( "QPE/System", "setVolume(int,int)" ) << 0, volumePerc; 32// QCopEnvelope( "QPE/System", "setVolume(int,int)" ) << 0, volumePerc;
34} 33}
35 34
36 35
37void VolumeControl::incVol( int ammount ) { 36void VolumeControl::incVol( int ammount ) {
38 int oldVol = getVolume(); 37 int oldVol = volume();
39 setVolume( oldVol + ammount); 38 setVolume( oldVol + ammount);
40} 39}
41 40
42void VolumeControl::decVol( int ammount ) { 41void VolumeControl::decVol( int ammount ) {
43 int oldVol = getVolume(); 42 int oldVol = volume();
44 setVolume( oldVol - ammount); 43 setVolume( oldVol - ammount);
45} 44}
46 45
47 46
48VolumeControl::VolumeControl( ) { 47VolumeControl::VolumeControl( ) {
49 getVolume(); 48 volume();
50} 49}
51 50
52VolumeControl::~VolumeControl() { 51VolumeControl::~VolumeControl() {
53 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; 52 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false;
54} 53}
55 54
56void VolumeControl::setMute(bool on) { 55void VolumeControl::setMute(bool on) {
57 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << on; 56 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << on;
58} 57}
59 58
60 59
61 60
62 61
diff --git a/noncore/multimedia/opieplayer2/volumecontrol.h b/noncore/multimedia/opieplayer2/volumecontrol.h
index d0d34a2..040f978 100644
--- a/noncore/multimedia/opieplayer2/volumecontrol.h
+++ b/noncore/multimedia/opieplayer2/volumecontrol.h
@@ -4,45 +4,45 @@
4 **********/ 4 **********/
5 5
6 6
7#ifndef VOLUMECONTROL_H 7#ifndef VOLUMECONTROL_H
8#define VOLUMECONTROL_H 8#define VOLUMECONTROL_H
9 9
10 10
11 11
12#include <qobject.h> 12#include <qobject.h>
13 13
14class VolumeControl : public QObject { 14class VolumeControl : public QObject {
15 Q_OBJECT 15 Q_OBJECT
16public: 16public:
17 VolumeControl(); 17 VolumeControl();
18 ~VolumeControl(); 18 ~VolumeControl();
19 19
20 // increase by "ammount" 20 // increase by "ammount"
21 void incVol( int ammount ); 21 void incVol( int ammount );
22 void decVol( int ammount ); 22 void decVol( int ammount );
23 23
24 /** 24 /**
25 * Get the volume in percent 25 * Get the volume in percent
26 * @return volume percentage 26 * @return volume percentage
27 */ 27 */
28 int getVolume(); 28 int volume();
29 29
30public slots: 30public slots:
31 31
32 /** 32 /**
33 * Set the volume in percent 33 * Set the volume in percent
34 * @value volumePerc between 0 and 100 34 * @value volumePerc between 0 and 100
35 */ 35 */
36 void setVolume( int volumePerc ); 36 void setVolume( int volumePerc );
37 37
38 void setMute(bool); 38 void setMute(bool);
39 39
40 40
41private: 41private:
42 42
43 int m_volumePerc; 43 int m_volumePerc;
44 44
45}; 45};
46 46
47#endif 47#endif
48 48
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 766ece2..12d80ba 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -50,49 +50,51 @@ XineControl::XineControl( QObject *parent, const char *name )
50 connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); 50 connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) );
51 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 51 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
52 connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 52 connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
53 connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); 53 connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
54 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 54 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
55 55
56 disabledSuspendScreenSaver = FALSE; 56 disabledSuspendScreenSaver = FALSE;
57} 57}
58 58
59XineControl::~XineControl() { 59XineControl::~XineControl() {
60#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 60#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
61 if ( disabledSuspendScreenSaver ) { 61 if ( disabledSuspendScreenSaver ) {
62 disabledSuspendScreenSaver = FALSE; 62 disabledSuspendScreenSaver = FALSE;
63 // Re-enable the suspend mode 63 // Re-enable the suspend mode
64 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 64 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
65 } 65 }
66#endif 66#endif
67 delete libXine; 67 delete libXine;
68} 68}
69 69
70void XineControl::play( const QString& fileName ) { 70void XineControl::play( const QString& fileName ) {
71 hasVideoChannel=FALSE; 71 hasVideoChannel=FALSE;
72 hasAudioChannel=FALSE; 72 hasAudioChannel=FALSE;
73 m_fileName = fileName; 73 m_fileName = fileName;
74
74 qDebug("<<FILENAME: " + fileName + ">>>>"); 75 qDebug("<<FILENAME: " + fileName + ">>>>");
76
75 libXine->play( fileName ); 77 libXine->play( fileName );
76 mediaPlayerState->setPlaying( true ); 78 mediaPlayerState->setPlaying( true );
77 // default to audio view until we know how to handle video 79 // default to audio view until we know how to handle video
78 // MediaDetect mdetect; 80 // MediaDetect mdetect;
79 char whichGui = mdetect.videoOrAudio( fileName ); 81 char whichGui = mdetect.videoOrAudio( fileName );
80 if (whichGui == 'f') { 82 if (whichGui == 'f') {
81 qDebug("Nicht erkannter Dateityp"); 83 qDebug("Nicht erkannter Dateityp");
82 return; 84 return;
83 } 85 }
84 86
85 if (whichGui == 'a') { 87 if (whichGui == 'a') {
86 libXine->setShowVideo( false ); 88 libXine->setShowVideo( false );
87 hasAudioChannel=TRUE; 89 hasAudioChannel=TRUE;
88 } else { 90 } else {
89 libXine->setShowVideo( true ); 91 libXine->setShowVideo( true );
90 hasVideoChannel=TRUE; 92 hasVideoChannel=TRUE;
91 } 93 }
92 94
93 // determine if slider is shown 95 // determine if slider is shown
94 mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); 96 mediaPlayerState->setIsStreaming( !libXine->isSeekable() );
95 // which gui (video / audio) 97 // which gui (video / audio)
96 mediaPlayerState->setView( whichGui ); 98 mediaPlayerState->setView( whichGui );
97 99
98#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 100#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h
index 88458be..4263b36 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.h
+++ b/noncore/multimedia/opieplayer2/xinecontrol.h
@@ -22,58 +22,58 @@
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 XINECONTROL_H 34#ifndef XINECONTROL_H
35#define XINECONTROL_H 35#define XINECONTROL_H
36 36
37#include "lib.h" 37#include "lib.h"
38#include "mediadetect.h" 38#include "mediadetect.h"
39#include <qobject.h> 39#include <qobject.h>
40 40
41class XineControl : public QObject { 41class XineControl : public QObject {
42 Q_OBJECT 42 Q_OBJECT
43public: 43public:
44 XineControl( QObject *parent = 0, const char *name =0 ); 44 XineControl( QObject *parent = 0, const char *name =0 );
45 ~XineControl(); 45 ~XineControl();
46 int m_length;
47 46
48 bool hasVideo() const { return hasVideoChannel; } 47 bool hasVideo() const { return hasVideoChannel; }
49 bool hasAudio() const { return hasAudioChannel; } 48 bool hasAudio() const { return hasAudioChannel; }
50 49
51public slots: 50public slots:
52 void play( const QString& fileName ); 51 void play( const QString& fileName );
53 void stop( bool ); 52 void stop( bool );
54 void pause( bool ); 53 void pause( bool );
55 void setFullscreen( bool ); 54 void setFullscreen( bool );
56 long currentTime(); 55 long currentTime();
57 void seekTo( long ); 56 void seekTo( long );
58 // get length of media file and set it 57 // get length of media file and set it
59 void length(); 58 void length();
60 long position(); 59 long position();
61 void nextMedia(); 60 void nextMedia();
62 void videoResized ( const QSize &s ); 61 void videoResized ( const QSize &s );
63 62
64private: 63private:
65 XINE::Lib *libXine; 64 XINE::Lib *libXine;
66 MediaDetect mdetect; 65 MediaDetect mdetect;
67 long m_currentTime; 66 long m_currentTime;
68 long m_position; 67 long m_position;
68 int m_length;
69 QString m_fileName; 69 QString m_fileName;
70 bool disabledSuspendScreenSaver; 70 bool disabledSuspendScreenSaver : 1;
71 bool hasVideoChannel; 71 bool hasVideoChannel : 1;
72 bool hasAudioChannel; 72 bool hasAudioChannel : 1;
73signals: 73signals:
74 void positionChanged( long ); 74 void positionChanged( long );
75 75
76}; 76};
77 77
78 78
79#endif 79#endif
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
index 3e28e54..bc95d86 100644
--- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp
+++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
@@ -120,89 +120,92 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
120 QDirectPainter dp ( this ); 120 QDirectPainter dp ( this );
121 121
122 int rot = dp. transformOrientation ( ) + m_rotation; 122 int rot = dp. transformOrientation ( ) + m_rotation;
123 123
124 uchar *fb = dp. frameBuffer ( ); 124 uchar *fb = dp. frameBuffer ( );
125 uchar *frame = m_buff; // rot == 0 ? m_buff : m_buff + ( m_thisframe. height ( ) - 1 ) * m_bytes_per_line_frame; 125 uchar *frame = m_buff; // rot == 0 ? m_buff : m_buff + ( m_thisframe. height ( ) - 1 ) * m_bytes_per_line_frame;
126 126
127 QRect framerect = qt_screen-> mapToDevice ( QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )), QSize ( qt_screen-> width ( ), qt_screen-> height ( ))); 127 QRect framerect = qt_screen-> mapToDevice ( QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )), QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
128 128
129 qt_bug_workaround_clip_rects. resize ( dp. numRects ( )); 129 qt_bug_workaround_clip_rects. resize ( dp. numRects ( ));
130 130
131 for ( int i = dp. numRects ( ) - 1; i >= 0; i-- ) { 131 for ( int i = dp. numRects ( ) - 1; i >= 0; i-- ) {
132 const QRect &clip = dp. rect ( i ); 132 const QRect &clip = dp. rect ( i );
133 133
134 qt_bug_workaround_clip_rects [i] = qt_screen-> mapFromDevice ( clip, QSize ( qt_screen-> width ( ), qt_screen-> height ( ))); 134 qt_bug_workaround_clip_rects [i] = qt_screen-> mapFromDevice ( clip, QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
135 135
136 uchar *dst = fb + ( clip. x ( ) * m_bytes_per_pixel ) + ( clip. y ( ) * m_bytes_per_line_fb ); 136 uchar *dst = fb + ( clip. x ( ) * m_bytes_per_pixel ) + ( clip. y ( ) * m_bytes_per_line_fb );
137 uchar *src = frame; 137 uchar *src = frame;
138 138
139 switch ( rot ) { 139 switch ( rot ) {
140 case 0: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) ); break; 140 case 0: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) ); break;
141 case 1: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_pixel ) ); break; 141 case 1: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_pixel ) ); break;
142 case 2: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_line_frame ) ); break; 142 case 2: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_line_frame ) ); break;
143 case 3: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) ); break; 143 case 3: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) ); break;
144 default: break;
144 } 145 }
145 146
146 uint leftfill = 0; 147 uint leftfill = 0;
147 uint framefill = 0; 148 uint framefill = 0;
148 uint rightfill = 0; 149 uint rightfill = 0;
149 uint clipwidth = clip. width ( ) * m_bytes_per_pixel; 150 uint clipwidth = clip. width ( ) * m_bytes_per_pixel;
150 151
151 if ( clip. left ( ) < framerect. left ( )) 152 if ( clip. left ( ) < framerect. left ( ))
152 leftfill = (( framerect. left ( ) - clip. left ( )) * m_bytes_per_pixel ) <? clipwidth; 153 leftfill = (( framerect. left ( ) - clip. left ( )) * m_bytes_per_pixel ) <? clipwidth;
153 if ( clip. right ( ) > framerect. right ( )) 154 if ( clip. right ( ) > framerect. right ( ))
154 rightfill = (( clip. right ( ) - framerect. right ( )) * m_bytes_per_pixel ) <? clipwidth; 155 rightfill = (( clip. right ( ) - framerect. right ( )) * m_bytes_per_pixel ) <? clipwidth;
155 156
156 framefill = clipwidth - ( leftfill + rightfill ); 157 framefill = clipwidth - ( leftfill + rightfill );
157 158
158 for ( int y = clip. top ( ); y <= clip. bottom ( ); y++ ) { 159 for ( int y = clip. top ( ); y <= clip. bottom ( ); y++ ) {
159 if (( y < framerect. top ( )) || ( y > framerect. bottom ( ))) { 160 if (( y < framerect. top ( )) || ( y > framerect. bottom ( ))) {
160 memset ( dst, 0, clipwidth ); 161 memset ( dst, 0, clipwidth );
161 } 162 }
162 else { 163 else {
163 if ( leftfill ) 164 if ( leftfill )
164 memset ( dst, 0, leftfill ); 165 memset ( dst, 0, leftfill );
165 166
166 if ( framefill ) { 167 if ( framefill ) {
167 switch ( rot ) { 168 switch ( rot ) {
168 case 0: memcpy ( dst + leftfill, src, framefill ); break; 169 case 0: memcpy ( dst + leftfill, src, framefill ); break;
169 case 1: memcpy_step ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break; 170 case 1: memcpy_step ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break;
170 case 2: memcpy_rev ( dst + leftfill, src, framefill ); break; 171 case 2: memcpy_rev ( dst + leftfill, src, framefill ); break;
171 case 3: memcpy_step_rev ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break; 172 case 3: memcpy_step_rev ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break;
173 default: break;
172 } 174 }
173 } 175 }
174 if ( rightfill ) 176 if ( rightfill )
175 memset ( dst + leftfill + framefill, 0, rightfill ); 177 memset ( dst + leftfill + framefill, 0, rightfill );
176 } 178 }
177 179
178 dst += m_bytes_per_line_fb; 180 dst += m_bytes_per_line_fb;
179 181
180 switch ( rot ) { 182 switch ( rot ) {
181 case 0: src += m_bytes_per_line_frame; break; 183 case 0: src += m_bytes_per_line_frame; break;
182 case 1: src -= m_bytes_per_pixel; break; 184 case 1: src -= m_bytes_per_pixel; break;
183 case 2: src -= m_bytes_per_line_frame; break; 185 case 2: src -= m_bytes_per_line_frame; break;
184 case 3: src += m_bytes_per_pixel; break; 186 case 3: src += m_bytes_per_pixel; break;
187 default: break;
185 } 188 }
186 } 189 }
187 } 190 }
188 } 191 }
189 //qWarning ( " ||| painting |||" ); 192 //qWarning ( " ||| painting |||" );
190 { 193 {
191 // QVFB hack by MArtin Jones 194 // QVFB hack by MArtin Jones
192 QPainter p ( this ); 195 QPainter p ( this );
193 196
194 for ( int i = qt_bug_workaround_clip_rects. size ( ) - 1; i >= 0; i-- ) { 197 for ( int i = qt_bug_workaround_clip_rects. size ( ) - 1; i >= 0; i-- ) {
195 p. fillRect ( QRect ( mapFromGlobal ( qt_bug_workaround_clip_rects [i]. topLeft ( )), qt_bug_workaround_clip_rects [i]. size ( )), QBrush ( NoBrush ) ); 198 p. fillRect ( QRect ( mapFromGlobal ( qt_bug_workaround_clip_rects [i]. topLeft ( )), qt_bug_workaround_clip_rects [i]. size ( )), QBrush ( NoBrush ) );
196 } 199 }
197 } 200 }
198 } 201 }
199 //qWarning( "painting >>>" ); 202 //qWarning( "painting >>>" );
200} 203}
201 204
202 205
203void XineVideoWidget::setImage ( QImage* image ) 206void XineVideoWidget::setImage ( QImage* image )
204{ 207{
205 delete m_image; 208 delete m_image;
206 m_image = image; 209 m_image = image;
207} 210}
208 211
@@ -223,48 +226,48 @@ void XineVideoWidget::setImage ( uchar* img, int w, int h, int bpl )
223 226
224 m_buff = img; 227 m_buff = img;
225 m_bytes_per_line_frame = bpl; 228 m_bytes_per_line_frame = bpl;
226 229
227 repaint ((( m_thisframe & m_lastframe ) != m_lastframe ) ? m_lastframe : m_thisframe, false ); 230 repaint ((( m_thisframe & m_lastframe ) != m_lastframe ) ? m_lastframe : m_thisframe, false );
228} 231}
229 232
230void XineVideoWidget::resizeEvent ( QResizeEvent * ) 233void XineVideoWidget::resizeEvent ( QResizeEvent * )
231{ 234{
232 QSize s = size ( ); 235 QSize s = size ( );
233 bool fs = ( s == qApp-> desktop ( )-> size ( )); 236 bool fs = ( s == qApp-> desktop ( )-> size ( ));
234 237
235 m_rotation = fs ? -qt_screen-> transformOrientation ( ) : 0; 238 m_rotation = fs ? -qt_screen-> transformOrientation ( ) : 0;
236 239
237 if ( fs && qt_screen-> isTransformed ( )) { 240 if ( fs && qt_screen-> isTransformed ( )) {
238 s = qt_screen-> mapToDevice ( s ); 241 s = qt_screen-> mapToDevice ( s );
239 } 242 }
240 243
241// qDebug ( "\n\nResize: %dx%d, Rot: %d", s.width(),s.height(),m_rotation ); 244// qDebug ( "\n\nResize: %dx%d, Rot: %d", s.width(),s.height(),m_rotation );
242 245
243 emit videoResized ( s ); 246 emit videoResized ( s );
244} 247}
245 248
246 249
247void XineVideoWidget::mousePressEvent ( QMouseEvent *me ) 250void XineVideoWidget::mousePressEvent ( QMouseEvent * /*me*/ )
248{ 251{
249 QWidget *p = parentWidget ( ); 252 QWidget *p = parentWidget ( );
250 253
251 if ( p ) { 254 if ( p ) {
252 // QMouseEvent pme ( QEvent::MouseButtonPress, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); 255 // QMouseEvent pme ( QEvent::MouseButtonPress, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( ));
253 256
254 // QApplication::sendEvent ( p, &pme ); 257 // QApplication::sendEvent ( p, &pme );
255 // emit clicked(); 258 // emit clicked();
256 } 259 }
257} 260}
258 261
259void XineVideoWidget::mouseReleaseEvent ( QMouseEvent *me ) 262void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ )
260{ 263{
261 QWidget *p = parentWidget ( ); 264 QWidget *p = parentWidget ( );
262 265
263 if ( p ) { 266 if ( p ) {
264 // QMouseEvent pme ( QEvent::MouseButtonRelease, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); 267 // QMouseEvent pme ( QEvent::MouseButtonRelease, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( ));
265 268
266 // QApplication::sendEvent ( p, &pme ); 269 // QApplication::sendEvent ( p, &pme );
267 emit clicked(); 270 emit clicked();
268 } 271 }
269} 272}
270 273