summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-02 23:22:22 (UTC)
committer simon <simon>2002-12-02 23:22:22 (UTC)
commit24a00c944aace8d7627c1eb0d7cc0ebf40731c57 (patch) (unidiff)
tree3ae5406e15f169849a50e12fec01faa4cfc035e3
parent779219b813f0eba82a8d9236fafd28dbafc594d1 (diff)
downloadopie-24a00c944aace8d7627c1eb0d7cc0ebf40731c57.zip
opie-24a00c944aace8d7627c1eb0d7cc0ebf40731c57.tar.gz
opie-24a00c944aace8d7627c1eb0d7cc0ebf40731c57.tar.bz2
- AudioWidget and VideoWidget are no more singletons via audioUI and
videoUI. this allows switching skins at run-time (the appropriate connections are already made and it works quite nicely :)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/main.cpp11
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp39
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h9
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp14
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h3
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp5
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h6
7 files changed, 56 insertions, 31 deletions
diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp
index 7d11ca0..7fc7b94 100644
--- a/noncore/multimedia/opieplayer2/main.cpp
+++ b/noncore/multimedia/opieplayer2/main.cpp
@@ -1,32 +1,25 @@
1 1
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include "mediaplayerstate.h" 3#include "mediaplayerstate.h"
4#include "playlistwidget.h" 4#include "playlistwidget.h"
5#include "audiowidget.h"
6#include "videowidget.h"
7#include "mediaplayer.h" 5#include "mediaplayer.h"
8 6
9PlayListWidget *playList; 7PlayListWidget *playList;
10AudioWidget *audioUI;
11VideoWidget *videoUI;
12 8
13int main(int argc, char **argv) { 9int main(int argc, char **argv) {
14 QPEApplication a(argc,argv); 10 QPEApplication a(argc,argv);
15 11
16 MediaPlayerState st( 0, "mediaPlayerState" ); 12 MediaPlayerState st( 0, "mediaPlayerState" );
17 PlayListWidget pl( st, 0, "playList" ); 13 PlayListWidget pl( st, 0, "playList" );
18 playList = &pl; 14 playList = &pl;
19 pl.showMaximized(); 15 pl.showMaximized();
20 AudioWidget aw( st, 0, "audioUI" );
21 audioUI = &aw;
22 VideoWidget vw( st, 0, "videoUI" );
23 videoUI = &vw;
24 a.processEvents();
25 MediaPlayer mp( st, 0, "mediaPlayer" ); 16 MediaPlayer mp( st, 0, "mediaPlayer" );
17 QObject::connect( &pl, SIGNAL( skinSelected() ),
18 &mp, SLOT( recreateAudioAndVideoWidgets() ) );
26 19
27 a.showMainDocumentWidget(&pl); 20 a.showMainDocumentWidget(&pl);
28 21
29 return a.exec(); 22 return a.exec();
30} 23}
31 24
32 25
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index eccb5d9..a9c74c4 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,353 +1,368 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <qpe/qlibrary.h> 2#include <qpe/qlibrary.h>
3#include <qpe/resource.h> 3#include <qpe/resource.h>
4#include <qpe/config.h> 4#include <qpe/config.h>
5#include <qpe/qcopenvelope_qws.h> 5#include <qpe/qcopenvelope_qws.h>
6#include <qfileinfo.h> 6#include <qfileinfo.h>
7 7
8#include <qmainwindow.h> 8#include <qmainwindow.h>
9#include <qmessagebox.h> 9#include <qmessagebox.h>
10#include <qwidgetstack.h> 10#include <qwidgetstack.h>
11#include <qfile.h> 11#include <qfile.h>
12 12
13#include "mediaplayer.h" 13#include "mediaplayer.h"
14#include "playlistwidget.h" 14#include "playlistwidget.h"
15#include "audiowidget.h" 15#include "audiowidget.h"
16#include "videowidget.h" 16#include "videowidget.h"
17#include "volumecontrol.h" 17#include "volumecontrol.h"
18 18
19#include "mediaplayerstate.h" 19#include "mediaplayerstate.h"
20 20
21// for setBacklight() 21// for setBacklight()
22#include <linux/fb.h> 22#include <linux/fb.h>
23#include <sys/file.h> 23#include <sys/file.h>
24#include <sys/ioctl.h> 24#include <sys/ioctl.h>
25 25
26 26
27extern AudioWidget *audioUI;
28extern VideoWidget *videoUI; 27extern VideoWidget *videoUI;
29extern PlayListWidget *playList; 28extern PlayListWidget *playList;
30 29
31 30
32#define FBIOBLANK 0x4611 31#define FBIOBLANK 0x4611
33 32
34MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) 33MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
35 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ) { 34 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ) {
36 35
36 audioUI = 0;
37 videoUI = 0;
38 xineControl = 0;
39 recreateAudioAndVideoWidgets();
40
37 fd=-1;fl=-1; 41 fd=-1;fl=-1;
38 playList->setCaption( tr( "OpiePlayer: Initializating" ) ); 42 playList->setCaption( tr( "OpiePlayer: Initializating" ) );
39 43
40 qApp->processEvents(); 44 qApp->processEvents();
41 // QPEApplication::grabKeyboard(); // EVIL 45 // QPEApplication::grabKeyboard(); // EVIL
42 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 46 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
43 47
44 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 48 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
45 49
46 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 50 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
47 51
48 connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 52 connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
49 connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 53 connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
50 connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); 54 connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) );
51 55
52 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
53 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
54 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
55 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
56
57 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
58 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
59 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
60 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
61
62 volControl = new VolumeControl; 56 volControl = new VolumeControl;
63 xineControl = new XineControl( mediaPlayerState );
64 Config cfg( "OpiePlayer" ); 57 Config cfg( "OpiePlayer" );
65 cfg.setGroup("PlayList"); 58 cfg.setGroup("PlayList");
66 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 59 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
67 playList->setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); 60 playList->setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() );
68} 61}
69 62
70MediaPlayer::~MediaPlayer() { 63MediaPlayer::~MediaPlayer() {
71 delete xineControl; 64 delete xineControl;
72 delete volControl; 65 delete volControl;
73} 66}
74 67
75void MediaPlayer::pauseCheck( bool b ) { 68void MediaPlayer::pauseCheck( bool b ) {
76 if ( b && !mediaPlayerState.isPlaying() ) { 69 if ( b && !mediaPlayerState.isPlaying() ) {
77 mediaPlayerState.setPaused( FALSE ); 70 mediaPlayerState.setPaused( FALSE );
78 } 71 }
79} 72}
80 73
81void MediaPlayer::play() { 74void MediaPlayer::play() {
82 mediaPlayerState.setPlaying( FALSE ); 75 mediaPlayerState.setPlaying( FALSE );
83 mediaPlayerState.setPlaying( TRUE ); 76 mediaPlayerState.setPlaying( TRUE );
84} 77}
85 78
86void MediaPlayer::setPlaying( bool play ) { 79void MediaPlayer::setPlaying( bool play ) {
87 if ( !play ) { 80 if ( !play ) {
88 return; 81 return;
89 } 82 }
90 83
91 if ( mediaPlayerState.isPaused() ) { 84 if ( mediaPlayerState.isPaused() ) {
92 mediaPlayerState.setPaused( FALSE ); 85 mediaPlayerState.setPaused( FALSE );
93 return; 86 return;
94 } 87 }
95 88
96 QString tickerText, time, fileName; 89 QString tickerText, time, fileName;
97 if ( playList->currentTab() != PlayListWidget::CurrentPlayList ) { 90 if ( playList->currentTab() != PlayListWidget::CurrentPlayList ) {
98 //if playing in file list.. play in a different way 91 //if playing in file list.. play in a different way
99 // random and looping settings enabled causes problems here, 92 // random and looping settings enabled causes problems here,
100 // since there is no selected file in the playlist, but a selected file in the file list, 93 // since there is no selected file in the playlist, but a selected file in the file list,
101 // so we remember and shutoff 94 // so we remember and shutoff
102 l = mediaPlayerState.isLooping(); 95 l = mediaPlayerState.isLooping();
103 if(l) { 96 if(l) {
104 mediaPlayerState.setLooping( false ); 97 mediaPlayerState.setLooping( false );
105 } 98 }
106 r = mediaPlayerState.isShuffled(); 99 r = mediaPlayerState.isShuffled();
107 mediaPlayerState.setShuffled( false ); 100 mediaPlayerState.setShuffled( false );
108 } 101 }
109 102
110 PlayListWidget::Entry playListEntry = playList->currentEntry(); 103 PlayListWidget::Entry playListEntry = playList->currentEntry();
111 fileName = playListEntry.name; 104 fileName = playListEntry.name;
112 xineControl->play( playListEntry.file ); 105 xineControl->play( playListEntry.file );
113 106
114 long seconds = mediaPlayerState.length(); 107 long seconds = mediaPlayerState.length();
115 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 108 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
116 109
117 if( fileName.left(4) == "http" ) { 110 if( fileName.left(4) == "http" ) {
118 fileName = QFileInfo( fileName ).baseName(); 111 fileName = QFileInfo( fileName ).baseName();
119 if ( xineControl->getMetaInfo().isEmpty() ) { 112 if ( xineControl->getMetaInfo().isEmpty() ) {
120 tickerText = tr( " File: " ) + fileName; 113 tickerText = tr( " File: " ) + fileName;
121 } else { 114 } else {
122 tickerText = xineControl->getMetaInfo(); 115 tickerText = xineControl->getMetaInfo();
123 } 116 }
124 } else { 117 } else {
125 if ( xineControl->getMetaInfo().isEmpty() ) { 118 if ( xineControl->getMetaInfo().isEmpty() ) {
126 tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; 119 tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " ";
127 } else { 120 } else {
128 tickerText = xineControl->getMetaInfo() + " Length: " + time + " "; 121 tickerText = xineControl->getMetaInfo() + " Length: " + time + " ";
129 } 122 }
130 } 123 }
131 audioUI->setTickerText( tickerText ); 124 audioUI->setTickerText( tickerText );
132} 125}
133 126
134 127
135void MediaPlayer::prev() { 128void MediaPlayer::prev() {
136 if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist 129 if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist
137 if ( playList->prev() ) { 130 if ( playList->prev() ) {
138 play(); 131 play();
139 } else if ( mediaPlayerState.isLooping() ) { 132 } else if ( mediaPlayerState.isLooping() ) {
140 if ( playList->last() ) { 133 if ( playList->last() ) {
141 play(); 134 play();
142 } 135 }
143 } else { 136 } else {
144 mediaPlayerState.setList(); 137 mediaPlayerState.setList();
145 } 138 }
146 } 139 }
147} 140}
148 141
149 142
150void MediaPlayer::next() { 143void MediaPlayer::next() {
151 144
152 if(playList->currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist 145 if(playList->currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist
153 if ( playList->next() ) { 146 if ( playList->next() ) {
154 play(); 147 play();
155 } else if ( mediaPlayerState.isLooping() ) { 148 } else if ( mediaPlayerState.isLooping() ) {
156 if ( playList->first() ) { 149 if ( playList->first() ) {
157 play(); 150 play();
158 } 151 }
159 } else { 152 } else {
160 mediaPlayerState.setList(); 153 mediaPlayerState.setList();
161 } 154 }
162 } else { //if playing from file list, let's just stop 155 } else { //if playing from file list, let's just stop
163 qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); 156 qDebug("<<<<<<<<<<<<<<<<<stop for filelists");
164 mediaPlayerState.setPlaying(false); 157 mediaPlayerState.setPlaying(false);
165 mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); 158 mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection );
166 if(l) mediaPlayerState.setLooping(l); 159 if(l) mediaPlayerState.setLooping(l);
167 if(r) mediaPlayerState.setShuffled(r); 160 if(r) mediaPlayerState.setShuffled(r);
168 } 161 }
169 qApp->processEvents(); 162 qApp->processEvents();
170} 163}
171 164
172 165
173void MediaPlayer::startDecreasingVolume() { 166void MediaPlayer::startDecreasingVolume() {
174 volumeDirection = -1; 167 volumeDirection = -1;
175 startTimer( 100 ); 168 startTimer( 100 );
176 volControl->decVol(2); 169 volControl->decVol(2);
177} 170}
178 171
179 172
180void MediaPlayer::startIncreasingVolume() { 173void MediaPlayer::startIncreasingVolume() {
181 volumeDirection = +1; 174 volumeDirection = +1;
182 startTimer( 100 ); 175 startTimer( 100 );
183 volControl->incVol(2); 176 volControl->incVol(2);
184} 177}
185 178
186 179
187bool drawnOnScreenDisplay = FALSE; 180bool drawnOnScreenDisplay = FALSE;
188unsigned int onScreenDisplayVolume = 0; 181unsigned int onScreenDisplayVolume = 0;
189const int yoff = 110; 182const int yoff = 110;
190 183
191void MediaPlayer::stopChangingVolume() { 184void MediaPlayer::stopChangingVolume() {
192 killTimers(); 185 killTimers();
193 // Get rid of the on-screen display stuff 186 // Get rid of the on-screen display stuff
194 drawnOnScreenDisplay = FALSE; 187 drawnOnScreenDisplay = FALSE;
195 onScreenDisplayVolume = 0; 188 onScreenDisplayVolume = 0;
196 int w=0; 189 int w=0;
197 int h=0; 190 int h=0;
198 if( !xineControl->hasVideo() ) { 191 if( !xineControl->hasVideo() ) {
199 w = audioUI->width(); 192 w = audioUI->width();
200 h = audioUI->height(); 193 h = audioUI->height();
201 audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); 194 audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE );
202 } else { 195 } else {
203 w = videoUI->width(); 196 w = videoUI->width();
204 h = videoUI->height(); 197 h = videoUI->height();
205 videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); 198 videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE );
206 } 199 }
207} 200}
208 201
209 202
210void MediaPlayer::timerEvent( QTimerEvent * ) { 203void MediaPlayer::timerEvent( QTimerEvent * ) {
211 if ( volumeDirection == +1 ) { 204 if ( volumeDirection == +1 ) {
212 volControl->incVol( 2 ); 205 volControl->incVol( 2 );
213 } else if ( volumeDirection == -1 ) { 206 } else if ( volumeDirection == -1 ) {
214 volControl->decVol( 2 ); 207 volControl->decVol( 2 );
215 } 208 }
216 209
217 210
218 // TODO FIXME 211 // TODO FIXME
219 // huh?? 212 // huh??
220 unsigned int v= 0; 213 unsigned int v= 0;
221 v = volControl->volume(); 214 v = volControl->volume();
222 v = v / 10; 215 v = v / 10;
223 216
224 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { 217 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) {
225 return; 218 return;
226 } 219 }
227 220
228 int w=0; int h=0; 221 int w=0; int h=0;
229 if( !xineControl->hasVideo() ) { 222 if( !xineControl->hasVideo() ) {
230 w = audioUI->width(); 223 w = audioUI->width();
231 h = audioUI->height(); 224 h = audioUI->height();
232 225
233 if ( drawnOnScreenDisplay ) { 226 if ( drawnOnScreenDisplay ) {
234 if ( onScreenDisplayVolume > v ) { 227 if ( onScreenDisplayVolume > v ) {
235 audioUI->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); 228 audioUI->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE );
236 } 229 }
237 } 230 }
238 drawnOnScreenDisplay = TRUE; 231 drawnOnScreenDisplay = TRUE;
239 onScreenDisplayVolume = v; 232 onScreenDisplayVolume = v;
240 QPainter p( audioUI ); 233 QPainter p( audioUI );
241 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 234 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
242 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 235 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
243 236
244 QFont f; 237 QFont f;
245 f.setPixelSize( 20 ); 238 f.setPixelSize( 20 );
246 f.setBold( TRUE ); 239 f.setBold( TRUE );
247 p.setFont( f ); 240 p.setFont( f );
248 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); 241 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") );
249 242
250 for ( unsigned int i = 0; i < 10; i++ ) { 243 for ( unsigned int i = 0; i < 10; i++ ) {
251 if ( v > i ) { 244 if ( v > i ) {
252 p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 245 p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
253 } else { 246 } else {
254 p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 247 p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
255 } 248 }
256 } 249 }
257 } else { 250 } else {
258 w = videoUI->width(); 251 w = videoUI->width();
259 h = videoUI->height(); 252 h = videoUI->height();
260 253
261 if ( drawnOnScreenDisplay ) { 254 if ( drawnOnScreenDisplay ) {
262 if ( onScreenDisplayVolume > v ) { 255 if ( onScreenDisplayVolume > v ) {
263 videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); 256 videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE );
264 } 257 }
265 } 258 }
266 drawnOnScreenDisplay = TRUE; 259 drawnOnScreenDisplay = TRUE;
267 onScreenDisplayVolume = v; 260 onScreenDisplayVolume = v;
268 QPainter p( videoUI ); 261 QPainter p( videoUI );
269 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 262 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
270 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 263 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
271 264
272 QFont f; 265 QFont f;
273 f.setPixelSize( 20 ); 266 f.setPixelSize( 20 );
274 f.setBold( TRUE ); 267 f.setBold( TRUE );
275 p.setFont( f ); 268 p.setFont( f );
276 p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); 269 p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) );
277 270
278 for ( unsigned int i = 0; i < 10; i++ ) { 271 for ( unsigned int i = 0; i < 10; i++ ) {
279 if ( v > i ) { 272 if ( v > i ) {
280 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 273 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
281 } else { 274 } else {
282 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 275 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
283 } 276 }
284 } 277 }
285 } 278 }
286} 279}
287 280
288 281
289void MediaPlayer::blank( bool b ) { 282void MediaPlayer::blank( bool b ) {
290 fd=open("/dev/fb0",O_RDWR); 283 fd=open("/dev/fb0",O_RDWR);
291#ifdef QT_QWS_EBX 284#ifdef QT_QWS_EBX
292 fl= open( "/dev/fl", O_RDWR ); 285 fl= open( "/dev/fl", O_RDWR );
293#endif 286#endif
294 if (fd != -1) { 287 if (fd != -1) {
295 if ( b ) { 288 if ( b ) {
296 qDebug("do blanking"); 289 qDebug("do blanking");
297#ifdef QT_QWS_EBX 290#ifdef QT_QWS_EBX
298 ioctl( fd, FBIOBLANK, 1 ); 291 ioctl( fd, FBIOBLANK, 1 );
299 if(fl !=-1) { 292 if(fl !=-1) {
300 ioctl( fl, 2 ); 293 ioctl( fl, 2 );
301 ::close(fl); 294 ::close(fl);
302 } 295 }
303#else 296#else
304 ioctl( fd, FBIOBLANK, 3 ); 297 ioctl( fd, FBIOBLANK, 3 );
305#endif 298#endif
306 isBlanked = TRUE; 299 isBlanked = TRUE;
307 } else { 300 } else {
308 qDebug("do unblanking"); 301 qDebug("do unblanking");
309 ioctl( fd, FBIOBLANK, 0); 302 ioctl( fd, FBIOBLANK, 0);
310#ifdef QT_QWS_EBX 303#ifdef QT_QWS_EBX
311 if(fl != -1) { 304 if(fl != -1) {
312 ioctl( fl, 1); 305 ioctl( fl, 1);
313 ::close(fl); 306 ::close(fl);
314 } 307 }
315#endif 308#endif
316 isBlanked = FALSE; 309 isBlanked = FALSE;
317 } 310 }
318 close( fd ); 311 close( fd );
319 } else { 312 } else {
320 qDebug("<< /dev/fb0 could not be opened >>"); 313 qDebug("<< /dev/fb0 could not be opened >>");
321 } 314 }
322} 315}
323 316
324void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 317void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
325 switch ( e->key() ) { 318 switch ( e->key() ) {
326////////////////////////////// Zaurus keys 319////////////////////////////// Zaurus keys
327 case Key_Home: 320 case Key_Home:
328 break; 321 break;
329 case Key_F9: //activity 322 case Key_F9: //activity
330 break; 323 break;
331 case Key_F10: //contacts 324 case Key_F10: //contacts
332 break; 325 break;
333 case Key_F11: //menu 326 case Key_F11: //menu
334 break; 327 break;
335 case Key_F12: //home 328 case Key_F12: //home
336 qDebug("Blank here"); 329 qDebug("Blank here");
337// mediaPlayerState->toggleBlank(); 330// mediaPlayerState->toggleBlank();
338 break; 331 break;
339 case Key_F13: //mail 332 case Key_F13: //mail
340 qDebug("Blank here"); 333 qDebug("Blank here");
341 // mediaPlayerState->toggleBlank(); 334 // mediaPlayerState->toggleBlank();
342 break; 335 break;
343 } 336 }
344} 337}
345 338
346void MediaPlayer::cleanUp() {// this happens on closing 339void MediaPlayer::cleanUp() {// this happens on closing
347 Config cfg( "OpiePlayer" ); 340 Config cfg( "OpiePlayer" );
348 mediaPlayerState.writeConfig( cfg ); 341 mediaPlayerState.writeConfig( cfg );
349 playList->writeDefaultPlaylist( ); 342 playList->writeDefaultPlaylist( );
350 343
351// QPEApplication::grabKeyboard(); 344// QPEApplication::grabKeyboard();
352// QPEApplication::ungrabKeyboard(); 345// QPEApplication::ungrabKeyboard();
353} 346}
347
348void MediaPlayer::recreateAudioAndVideoWidgets()
349{
350 delete xineControl;
351 delete audioUI;
352 delete videoUI;
353 audioUI = new AudioWidget( mediaPlayerState, 0, "audioUI" );
354 videoUI = new VideoWidget( mediaPlayerState, 0, "videoUI" );
355
356 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
357 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
358 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
359 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
360
361 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
362 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
363 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
364 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
365
366 xineControl = new XineControl( videoUI, mediaPlayerState );
367}
368
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h
index 6aeac7c..0d6f722 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.h
+++ b/noncore/multimedia/opieplayer2/mediaplayer.h
@@ -1,77 +1,86 @@
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 LJP <> 5 Copyright (c) 2002 LJP <>
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 MEDIA_PLAYER_H 34#ifndef MEDIA_PLAYER_H
35#define MEDIA_PLAYER_H 35#define MEDIA_PLAYER_H
36 36
37#include <qmainwindow.h> 37#include <qmainwindow.h>
38#include <qframe.h> 38#include <qframe.h>
39 39
40#include "xinecontrol.h" 40#include "xinecontrol.h"
41 41
42class DocLnk; 42class DocLnk;
43class VolumeControl; 43class VolumeControl;
44class MediaPlayerState; 44class MediaPlayerState;
45class AudioWidget;
46class VideoWidget;
45 47
46class MediaPlayer : public QObject { 48class MediaPlayer : public QObject {
47 Q_OBJECT 49 Q_OBJECT
48public: 50public:
49 MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); 51 MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name );
50 ~MediaPlayer(); 52 ~MediaPlayer();
53
54public slots:
55 void recreateAudioAndVideoWidgets();
56
51private slots: 57private slots:
52 void setPlaying( bool ); 58 void setPlaying( bool );
53 void pauseCheck( bool ); 59 void pauseCheck( bool );
54 void play(); 60 void play();
55 void next(); 61 void next();
56 void prev(); 62 void prev();
57 void startIncreasingVolume(); 63 void startIncreasingVolume();
58 void startDecreasingVolume(); 64 void startDecreasingVolume();
59 void stopChangingVolume(); 65 void stopChangingVolume();
60 void cleanUp(); 66 void cleanUp();
61 void blank( bool ); 67 void blank( bool );
62 68
63protected: 69protected:
64 void timerEvent( QTimerEvent *e ); 70 void timerEvent( QTimerEvent *e );
65 void keyReleaseEvent( QKeyEvent *e); 71 void keyReleaseEvent( QKeyEvent *e);
66private: 72private:
73
67 bool isBlanked, l, r; 74 bool isBlanked, l, r;
68 int fd, fl; 75 int fd, fl;
69 int volumeDirection; 76 int volumeDirection;
70 XineControl *xineControl; 77 XineControl *xineControl;
71 VolumeControl *volControl; 78 VolumeControl *volControl;
72 MediaPlayerState &mediaPlayerState; 79 MediaPlayerState &mediaPlayerState;
80 AudioWidget *audioUI;
81 VideoWidget *videoUI;
73}; 82};
74 83
75 84
76#endif // MEDIA_PLAYER_H 85#endif // MEDIA_PLAYER_H
77 86
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 7ba342b..6bda71e 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -906,223 +906,225 @@ void PlayListWidget::readPls( const QString &filename ) {
906 m3uList->close(); 906 m3uList->close();
907 if(m3uList) delete m3uList; 907 if(m3uList) delete m3uList;
908} 908}
909 909
910/* 910/*
911 writes current playlist to current m3u file */ 911 writes current playlist to current m3u file */
912void PlayListWidget::writeCurrentM3u() { 912void PlayListWidget::writeCurrentM3u() {
913 qDebug("writing to current m3u"); 913 qDebug("writing to current m3u");
914 Config cfg( "OpiePlayer" ); 914 Config cfg( "OpiePlayer" );
915 cfg.setGroup("PlayList"); 915 cfg.setGroup("PlayList");
916 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 916 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
917 917
918 Om3u *m3uList; 918 Om3u *m3uList;
919 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); 919 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate );
920 if( d->selectedFiles->first()) { 920 if( d->selectedFiles->first()) {
921 921
922 do { 922 do {
923 // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); 923 // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file());
924 m3uList->add( d->selectedFiles->current()->file() ); 924 m3uList->add( d->selectedFiles->current()->file() );
925 } 925 }
926 while ( d->selectedFiles->next() ); 926 while ( d->selectedFiles->next() );
927 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); 927 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" );
928 m3uList->write(); 928 m3uList->write();
929 m3uList->close(); 929 m3uList->close();
930 930
931 if(m3uList) delete m3uList; 931 if(m3uList) delete m3uList;
932 } 932 }
933 933
934} 934}
935 935
936 /* 936 /*
937 writes current playlist to m3u file */ 937 writes current playlist to m3u file */
938void PlayListWidget::writem3u() { 938void PlayListWidget::writem3u() {
939 InputDialog *fileDlg; 939 InputDialog *fileDlg;
940 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); 940 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
941 fileDlg->exec(); 941 fileDlg->exec();
942 QString name, filename, list; 942 QString name, filename, list;
943 Om3u *m3uList; 943 Om3u *m3uList;
944 944
945 if( fileDlg->result() == 1 ) { 945 if( fileDlg->result() == 1 ) {
946 name = fileDlg->text(); 946 name = fileDlg->text();
947// qDebug( filename ); 947// qDebug( filename );
948 948
949 if( name.left( 1) != "/" ) { 949 if( name.left( 1) != "/" ) {
950 filename = QPEApplication::documentDir() + "/" + name; 950 filename = QPEApplication::documentDir() + "/" + name;
951 } 951 }
952 952
953 if( name.right( 3 ) != "m3u" ) { 953 if( name.right( 3 ) != "m3u" ) {
954 filename = QPEApplication::documentDir() + "/" +name+".m3u"; 954 filename = QPEApplication::documentDir() + "/" +name+".m3u";
955 } 955 }
956 956
957 if( d->selectedFiles->first()) { 957 if( d->selectedFiles->first()) {
958 m3uList = new Om3u(filename, IO_ReadWrite); 958 m3uList = new Om3u(filename, IO_ReadWrite);
959 959
960 do { 960 do {
961 m3uList->add( d->selectedFiles->current()->file()); 961 m3uList->add( d->selectedFiles->current()->file());
962 } 962 }
963 while ( d->selectedFiles->next() ); 963 while ( d->selectedFiles->next() );
964 // qDebug( list ); 964 // qDebug( list );
965 m3uList->write(); 965 m3uList->write();
966 m3uList->close(); 966 m3uList->close();
967 if(m3uList) delete m3uList; 967 if(m3uList) delete m3uList;
968 968
969 if(fileDlg) delete fileDlg; 969 if(fileDlg) delete fileDlg;
970 970
971 DocLnk lnk; 971 DocLnk lnk;
972 lnk.setFile( filename); 972 lnk.setFile( filename);
973 lnk.setIcon("opieplayer2/playlist2"); 973 lnk.setIcon("opieplayer2/playlist2");
974 lnk.setName( name); //sets file name 974 lnk.setName( name); //sets file name
975 975
976 // qDebug(filename); 976 // qDebug(filename);
977 Config config( "OpiePlayer" ); 977 Config config( "OpiePlayer" );
978 config.setGroup( "PlayList" ); 978 config.setGroup( "PlayList" );
979 979
980 config.writeEntry("CurrentPlaylist",filename); 980 config.writeEntry("CurrentPlaylist",filename);
981 currentPlayList=filename; 981 currentPlayList=filename;
982 982
983 if(!lnk.writeLink()) { 983 if(!lnk.writeLink()) {
984 qDebug("Writing doclink did not work"); 984 qDebug("Writing doclink did not work");
985 } 985 }
986 986
987 setCaption(tr("OpiePlayer: ") + name); 987 setCaption(tr("OpiePlayer: ") + name);
988 } 988 }
989 } 989 }
990} 990}
991 991
992void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { 992void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
993 switch ( e->key() ) { 993 switch ( e->key() ) {
994 ////////////////////////////// Zaurus keys 994 ////////////////////////////// Zaurus keys
995 case Key_F9: //activity 995 case Key_F9: //activity
996 // if(audioUI->isHidden()) 996 // if(audioUI->isHidden())
997 // audioUI->showMaximized(); 997 // audioUI->showMaximized();
998 break; 998 break;
999 case Key_F10: //contacts 999 case Key_F10: //contacts
1000 // if( videoUI->isHidden()) 1000 // if( videoUI->isHidden())
1001 // videoUI->showMaximized(); 1001 // videoUI->showMaximized();
1002 break; 1002 break;
1003 case Key_F11: //menu 1003 case Key_F11: //menu
1004 break; 1004 break;
1005 case Key_F12: //home 1005 case Key_F12: //home
1006 // doBlank(); 1006 // doBlank();
1007 break; 1007 break;
1008 case Key_F13: //mail 1008 case Key_F13: //mail
1009 // doUnblank(); 1009 // doUnblank();
1010 break; 1010 break;
1011 case Key_Q: //add to playlist 1011 case Key_Q: //add to playlist
1012 addSelected(); 1012 addSelected();
1013 break; 1013 break;
1014 case Key_R: //remove from playlist 1014 case Key_R: //remove from playlist
1015 removeSelected(); 1015 removeSelected();
1016 break; 1016 break;
1017 // case Key_P: //play 1017 // case Key_P: //play
1018 // qDebug("Play"); 1018 // qDebug("Play");
1019 // playSelected(); 1019 // playSelected();
1020 // break; 1020 // break;
1021 case Key_Space: 1021 case Key_Space:
1022 // playSelected(); puh 1022 // playSelected(); puh
1023 break; 1023 break;
1024 case Key_1: 1024 case Key_1:
1025 tabWidget->setCurrentPage( 0 ); 1025 tabWidget->setCurrentPage( 0 );
1026 break; 1026 break;
1027 case Key_2: 1027 case Key_2:
1028 tabWidget->setCurrentPage( 1 ); 1028 tabWidget->setCurrentPage( 1 );
1029 break; 1029 break;
1030 case Key_3: 1030 case Key_3:
1031 tabWidget->setCurrentPage( 2 ); 1031 tabWidget->setCurrentPage( 2 );
1032 break; 1032 break;
1033 case Key_4: 1033 case Key_4:
1034 tabWidget->setCurrentPage( 3 ); 1034 tabWidget->setCurrentPage( 3 );
1035 break; 1035 break;
1036 case Key_Down: 1036 case Key_Down:
1037 if ( !d->selectedFiles->next() ) 1037 if ( !d->selectedFiles->next() )
1038 d->selectedFiles->first(); 1038 d->selectedFiles->first();
1039 break; 1039 break;
1040 case Key_Up: 1040 case Key_Up:
1041 if ( !d->selectedFiles->prev() ) 1041 if ( !d->selectedFiles->prev() )
1042 // d->selectedFiles->last(); 1042 // d->selectedFiles->last();
1043 break; 1043 break;
1044 } 1044 }
1045} 1045}
1046 1046
1047void PlayListWidget::pmViewActivated(int index) { 1047void PlayListWidget::pmViewActivated(int index) {
1048// qDebug("%d", index); 1048// qDebug("%d", index);
1049 switch(index) { 1049 switch(index) {
1050 case -16: 1050 case -16:
1051 { 1051 {
1052 mediaPlayerState.toggleFullscreen(); 1052 mediaPlayerState.toggleFullscreen();
1053 bool b=mediaPlayerState.isFullscreen(); 1053 bool b=mediaPlayerState.isFullscreen();
1054 pmView->setItemChecked( index, b); 1054 pmView->setItemChecked( index, b);
1055 Config cfg( "OpiePlayer" ); 1055 Config cfg( "OpiePlayer" );
1056 cfg.writeEntry( "FullScreen", b ); 1056 cfg.writeEntry( "FullScreen", b );
1057 } 1057 }
1058 break; 1058 break;
1059 }; 1059 };
1060} 1060}
1061 1061
1062void PlayListWidget::populateSkinsMenu() { 1062void PlayListWidget::populateSkinsMenu() {
1063 int item = 0; 1063 int item = 0;
1064 defaultSkinIndex = 0; 1064 defaultSkinIndex = 0;
1065 QString skinName; 1065 QString skinName;
1066 Config cfg( "OpiePlayer" ); 1066 Config cfg( "OpiePlayer" );
1067 cfg.setGroup("Options" ); 1067 cfg.setGroup("Options" );
1068 QString skin = cfg.readEntry( "Skin", "default" ); 1068 QString skin = cfg.readEntry( "Skin", "default" );
1069 1069
1070 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); 1070 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
1071 skinsDir.setFilter( QDir::Dirs ); 1071 skinsDir.setFilter( QDir::Dirs );
1072 skinsDir.setSorting(QDir::Name ); 1072 skinsDir.setSorting(QDir::Name );
1073 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 1073 const QFileInfoList *skinslist = skinsDir.entryInfoList();
1074 QFileInfoListIterator it( *skinslist ); 1074 QFileInfoListIterator it( *skinslist );
1075 QFileInfo *fi; 1075 QFileInfo *fi;
1076 while ( ( fi = it.current() ) ) { 1076 while ( ( fi = it.current() ) ) {
1077 skinName = fi->fileName(); 1077 skinName = fi->fileName();
1078// qDebug( fi->fileName() ); 1078// qDebug( fi->fileName() );
1079 if( skinName != "." && skinName != ".." && skinName !="CVS" ) { 1079 if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
1080 item = skinsMenu->insertItem( fi->fileName() ) ; 1080 item = skinsMenu->insertItem( fi->fileName() ) ;
1081 } 1081 }
1082 if( skinName == "default" ) { 1082 if( skinName == "default" ) {
1083 defaultSkinIndex = item; 1083 defaultSkinIndex = item;
1084 } 1084 }
1085 if( skinName == skin ) { 1085 if( skinName == skin ) {
1086 skinsMenu->setItemChecked( item, TRUE ); 1086 skinsMenu->setItemChecked( item, TRUE );
1087 } 1087 }
1088 ++it; 1088 ++it;
1089 } 1089 }
1090} 1090}
1091 1091
1092void PlayListWidget::skinsMenuActivated( int item ) { 1092void PlayListWidget::skinsMenuActivated( int item ) {
1093 for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { 1093 for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) {
1094 skinsMenu->setItemChecked( i, FALSE ); 1094 skinsMenu->setItemChecked( i, FALSE );
1095 } 1095 }
1096 skinsMenu->setItemChecked( item, TRUE ); 1096 skinsMenu->setItemChecked( item, TRUE );
1097 1097
1098 Config cfg( "OpiePlayer" ); 1098 {
1099 cfg.setGroup("Options"); 1099 Config cfg( "OpiePlayer" );
1100 cfg.writeEntry("Skin", skinsMenu->text( item ) ); 1100 cfg.setGroup("Options");
1101 QMessageBox::warning( this, tr( "OpiePlayer" ), 1101 cfg.writeEntry("Skin", skinsMenu->text( item ) );
1102 tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); 1102 }
1103} 1103
1104 emit skinSelected();
1105}
1104 1106
1105PlayListWidget::TabType PlayListWidget::currentTab() const 1107PlayListWidget::TabType PlayListWidget::currentTab() const
1106{ 1108{
1107 static const TabType indexToTabType[ TabTypeCount ] = 1109 static const TabType indexToTabType[ TabTypeCount ] =
1108 { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; 1110 { CurrentPlayList, AudioFiles, VideoFiles, PlayLists };
1109 1111
1110 int index = tabWidget->currentPageIndex(); 1112 int index = tabWidget->currentPageIndex();
1111 assert( index < TabTypeCount && index >= 0 ); 1113 assert( index < TabTypeCount && index >= 0 );
1112 1114
1113 return indexToTabType[ index ]; 1115 return indexToTabType[ index ];
1114} 1116}
1115 1117
1116PlayListWidget::Entry PlayListWidget::currentEntry() const 1118PlayListWidget::Entry PlayListWidget::currentEntry() const
1117{ 1119{
1118 if ( currentTab() == CurrentPlayList ) { 1120 if ( currentTab() == CurrentPlayList ) {
1119 const DocLnk *lnk = current(); 1121 const DocLnk *lnk = current();
1120 return Entry( lnk->name(), lnk->file() ); 1122 return Entry( lnk->name(), lnk->file() );
1121 } 1123 }
1122 1124
1123 return Entry( currentFileListPathName() ); 1125 return Entry( currentFileListPathName() );
1124} 1126}
1125 1127
1126QString PlayListWidget::currentFileListPathName() const { 1128QString PlayListWidget::currentFileListPathName() const {
1127 return currentFileListView()->currentItem()->text( 3 ); 1129 return currentFileListView()->currentItem()->text( 3 );
1128} 1130}
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index 3f52e63..ad5c9a3 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -1,141 +1,144 @@
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#ifndef PLAY_LIST_WIDGET_H 34#ifndef PLAY_LIST_WIDGET_H
35#define PLAY_LIST_WIDGET_H 35#define PLAY_LIST_WIDGET_H
36 36
37#include <qmainwindow.h> 37#include <qmainwindow.h>
38#include <qpe/applnk.h> 38#include <qpe/applnk.h>
39#include <qtabwidget.h> 39#include <qtabwidget.h>
40#include <qpe/fileselector.h> 40#include <qpe/fileselector.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qpopupmenu.h> 42#include <qpopupmenu.h>
43 43
44#include "playlistwidgetgui.h" 44#include "playlistwidgetgui.h"
45 45
46 46
47//class PlayListWidgetPrivate; 47//class PlayListWidgetPrivate;
48class Config; 48class Config;
49class QListViewItem; 49class QListViewItem;
50class QListView; 50class QListView;
51class QPoint; 51class QPoint;
52class QAction; 52class QAction;
53class QLabel; 53class QLabel;
54 54
55class PlayListWidget : public PlayListWidgetGui { 55class PlayListWidget : public PlayListWidgetGui {
56 Q_OBJECT 56 Q_OBJECT
57public: 57public:
58 enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; 58 enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists };
59 enum { TabTypeCount = 4 }; 59 enum { TabTypeCount = 4 };
60 60
61 struct Entry 61 struct Entry
62 { 62 {
63 Entry( const QString &_name, const QString &_fileName ) 63 Entry( const QString &_name, const QString &_fileName )
64 : name( _name ), file( _fileName ) {} 64 : name( _name ), file( _fileName ) {}
65 Entry( const QString &_fileName ) 65 Entry( const QString &_fileName )
66 : name( _fileName ), file( _fileName ) {} 66 : name( _fileName ), file( _fileName ) {}
67 67
68 QString name; 68 QString name;
69 QString file; 69 QString file;
70 }; 70 };
71 71
72 PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); 72 PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
73 ~PlayListWidget(); 73 ~PlayListWidget();
74 DocLnkSet files; 74 DocLnkSet files;
75 DocLnkSet vFiles; 75 DocLnkSet vFiles;
76 bool fromSetDocument; 76 bool fromSetDocument;
77 bool insanityBool; 77 bool insanityBool;
78 QString setDocFileRef, currentPlayList; 78 QString setDocFileRef, currentPlayList;
79 // retrieve the current playlist entry (media file link) 79 // retrieve the current playlist entry (media file link)
80 const DocLnk *current() const; 80 const DocLnk *current() const;
81 void useSelectedDocument(); 81 void useSelectedDocument();
82 int selected; 82 int selected;
83 TabType currentTab() const; 83 TabType currentTab() const;
84 84
85 Entry currentEntry() const; 85 Entry currentEntry() const;
86 86
87public slots: 87public slots:
88 bool first(); 88 bool first();
89 bool last(); 89 bool last();
90 bool next(); 90 bool next();
91 bool prev(); 91 bool prev();
92 void writeDefaultPlaylist( ); 92 void writeDefaultPlaylist( );
93 QString currentFileListPathName() const; 93 QString currentFileListPathName() const;
94protected: 94protected:
95 void keyReleaseEvent( QKeyEvent *e); 95 void keyReleaseEvent( QKeyEvent *e);
96 96
97signals:
98 void skinSelected();
99
97private: 100private:
98 int defaultSkinIndex; 101 int defaultSkinIndex;
99 bool audioScan, videoScan, audioPopulated, videoPopulated; 102 bool audioScan, videoScan, audioPopulated, videoPopulated;
100 void readm3u(const QString &); 103 void readm3u(const QString &);
101 void readPls(const QString &); 104 void readPls(const QString &);
102 void initializeStates(); 105 void initializeStates();
103 void populateAudioView(); 106 void populateAudioView();
104 void populateVideoView(); 107 void populateVideoView();
105 108
106 QListView *currentFileListView() const; 109 QListView *currentFileListView() const;
107 110
108 bool inFileListMode() const; 111 bool inFileListMode() const;
109 112
110private slots: 113private slots:
111 void populateSkinsMenu(); 114 void populateSkinsMenu();
112 void skinsMenuActivated(int); 115 void skinsMenuActivated(int);
113 void pmViewActivated(int); 116 void pmViewActivated(int);
114 void writem3u(); 117 void writem3u();
115 void writeCurrentM3u(); 118 void writeCurrentM3u();
116 void scanForAudio(); 119 void scanForAudio();
117 void scanForVideo(); 120 void scanForVideo();
118 void openFile(); 121 void openFile();
119 void setDocument( const QString& fileref ); 122 void setDocument( const QString& fileref );
120 void addToSelection( const DocLnk& ); // Add a media file to the playlist 123 void addToSelection( const DocLnk& ); // Add a media file to the playlist
121 void addToSelection( QListViewItem* ); // Add a media file to the playlist 124 void addToSelection( QListViewItem* ); // Add a media file to the playlist
122 void clearList(); 125 void clearList();
123 void addAllToList(); 126 void addAllToList();
124 void addAllMusicToList(); 127 void addAllMusicToList();
125 void addAllVideoToList(); 128 void addAllVideoToList();
126 void saveList(); // Save the playlist 129 void saveList(); // Save the playlist
127 void loadList( const DocLnk &); // Load a playlist 130 void loadList( const DocLnk &); // Load a playlist
128 void playIt( QListViewItem *); 131 void playIt( QListViewItem *);
129 void btnPlay(bool); 132 void btnPlay(bool);
130 void deletePlaylist(); 133 void deletePlaylist();
131 void addSelected(); 134 void addSelected();
132 void removeSelected(); 135 void removeSelected();
133 void tabChanged(QWidget*); 136 void tabChanged(QWidget*);
134 void viewPressed( int, QListViewItem *, const QPoint&, int); 137 void viewPressed( int, QListViewItem *, const QPoint&, int);
135 void playlistViewPressed( int, QListViewItem *, const QPoint&, int); 138 void playlistViewPressed( int, QListViewItem *, const QPoint&, int);
136 void playSelected(); 139 void playSelected();
137 140
138}; 141};
139 142
140#endif // PLAY_LIST_WIDGET_H 143#endif // PLAY_LIST_WIDGET_H
141 144
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 071ef7c..b4ae783 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -1,237 +1,236 @@
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 VideoWidget *videoUI; 43XineControl::XineControl( VideoWidget *videoWidget, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
44XineControl::XineControl( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) 44 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), videoUI( videoWidget ) {
45 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ) {
46 45
47 libXine = new XINE::Lib( videoUI->vidWidget() ); 46 libXine = new XINE::Lib( videoUI->vidWidget() );
48 47
49 connect ( videoUI, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) ); 48 connect ( videoUI, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) );
50 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); 49 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) );
51 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); 50 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) );
52 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 51 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
53 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 52 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
54 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); 53 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
55 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); 54 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) );
56 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 55 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
57 56
58 disabledSuspendScreenSaver = FALSE; 57 disabledSuspendScreenSaver = FALSE;
59} 58}
60 59
61XineControl::~XineControl() { 60XineControl::~XineControl() {
62#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 61#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
63 if ( disabledSuspendScreenSaver ) { 62 if ( disabledSuspendScreenSaver ) {
64 disabledSuspendScreenSaver = FALSE; 63 disabledSuspendScreenSaver = FALSE;
65 // Re-enable the suspend mode 64 // Re-enable the suspend mode
66 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 65 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
67 } 66 }
68#endif 67#endif
69 delete libXine; 68 delete libXine;
70} 69}
71 70
72void XineControl::play( const QString& fileName ) { 71void XineControl::play( const QString& fileName ) {
73 hasVideoChannel = FALSE; 72 hasVideoChannel = FALSE;
74 hasAudioChannel = FALSE; 73 hasAudioChannel = FALSE;
75 m_fileName = fileName; 74 m_fileName = fileName;
76 75
77 qDebug("<<FILENAME: " + fileName + ">>>>"); 76 qDebug("<<FILENAME: " + fileName + ">>>>");
78 77
79 if ( !libXine->play( fileName, 0, 0 ) ) { 78 if ( !libXine->play( fileName, 0, 0 ) ) {
80 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 79 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
81 // toggle stop so the the play button is reset 80 // toggle stop so the the play button is reset
82 mediaPlayerState.setPlaying( false ); 81 mediaPlayerState.setPlaying( false );
83 return; 82 return;
84 } 83 }
85 mediaPlayerState.setPlaying( true ); 84 mediaPlayerState.setPlaying( true );
86 85
87 MediaPlayerState::DisplayType displayType; 86 MediaPlayerState::DisplayType displayType;
88 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); 87 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) );
89 if ( !libXine->hasVideo() ) { 88 if ( !libXine->hasVideo() ) {
90 displayType = MediaPlayerState::Audio; 89 displayType = MediaPlayerState::Audio;
91 qDebug("HAS AUDIO"); 90 qDebug("HAS AUDIO");
92 libXine->setShowVideo( false ); 91 libXine->setShowVideo( false );
93 hasAudioChannel = TRUE; 92 hasAudioChannel = TRUE;
94 } else { 93 } else {
95 displayType = MediaPlayerState::Video; 94 displayType = MediaPlayerState::Video;
96 qDebug("HAS VIDEO"); 95 qDebug("HAS VIDEO");
97 libXine->setShowVideo( true ); 96 libXine->setShowVideo( true );
98 hasVideoChannel = TRUE; 97 hasVideoChannel = TRUE;
99 } 98 }
100 // determine if slider is shown 99 // determine if slider is shown
101 mediaPlayerState.setIsSeekable( libXine->isSeekable() ); 100 mediaPlayerState.setIsSeekable( libXine->isSeekable() );
102 101
103 // which gui (video / audio) 102 // which gui (video / audio)
104 mediaPlayerState.setDisplayType( displayType ); 103 mediaPlayerState.setDisplayType( displayType );
105 104
106#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 105#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
107 if ( !disabledSuspendScreenSaver ) { 106 if ( !disabledSuspendScreenSaver ) {
108 disabledSuspendScreenSaver = TRUE; 107 disabledSuspendScreenSaver = TRUE;
109 // Stop the screen from blanking and power saving state 108 // Stop the screen from blanking and power saving state
110 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) 109 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" )
111 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 110 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend );
112 } 111 }
113#endif 112#endif
114 113
115 length(); 114 length();
116 position(); 115 position();
117} 116}
118 117
119void XineControl::nextMedia() { 118void XineControl::nextMedia() {
120 mediaPlayerState.setNext(); 119 mediaPlayerState.setNext();
121} 120}
122 121
123void XineControl::setGamma( int value ) { 122void XineControl::setGamma( int value ) {
124 libXine->setGamma( value ); 123 libXine->setGamma( value );
125} 124}
126 125
127void XineControl::stop( bool isSet ) { 126void XineControl::stop( bool isSet ) {
128 if ( !isSet ) { 127 if ( !isSet ) {
129 libXine->stop(); 128 libXine->stop();
130 129
131#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 130#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
132 if ( disabledSuspendScreenSaver ) { 131 if ( disabledSuspendScreenSaver ) {
133 disabledSuspendScreenSaver = FALSE; 132 disabledSuspendScreenSaver = FALSE;
134 // Re-enable the suspend mode 133 // Re-enable the suspend mode
135 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 134 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
136 } 135 }
137#endif 136#endif
138 } 137 }
139} 138}
140 139
141/** 140/**
142 * Pause playback 141 * Pause playback
143 * @isSet 142 * @isSet
144 */ 143 */
145void XineControl::pause( bool isSet) { 144void XineControl::pause( bool isSet) {
146 if ( isSet ) { 145 if ( isSet ) {
147 libXine->pause(); 146 libXine->pause();
148 } else { 147 } else {
149 libXine->play( m_fileName, 0, m_currentTime ); 148 libXine->play( m_fileName, 0, m_currentTime );
150 } 149 }
151} 150}
152 151
153 152
154/** 153/**
155 * get current time in playback 154 * get current time in playback
156 */ 155 */
157long XineControl::currentTime() { 156long XineControl::currentTime() {
158 // todo: jede sekunde überprüfen 157 // todo: jede sekunde überprüfen
159 m_currentTime = libXine->currentTime(); 158 m_currentTime = libXine->currentTime();
160 return m_currentTime; 159 return m_currentTime;
161 QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); 160 QTimer::singleShot( 1000, this, SLOT( currentTime() ) );
162} 161}
163 162
164/** 163/**
165 * Set the length of the media file 164 * Set the length of the media file
166 */ 165 */
167void XineControl::length() { 166void XineControl::length() {
168 m_length = libXine->length(); 167 m_length = libXine->length();
169 mediaPlayerState.setLength( m_length ); 168 mediaPlayerState.setLength( m_length );
170} 169}
171 170
172 171
173/** 172/**
174 * Reports the position the xine backend is at right now 173 * Reports the position the xine backend is at right now
175 * @return long the postion in seconds 174 * @return long the postion in seconds
176 */ 175 */
177long XineControl::position() { 176long XineControl::position() {
178 m_position = ( currentTime() ); 177 m_position = ( currentTime() );
179 mediaPlayerState.updatePosition( m_position ); 178 mediaPlayerState.updatePosition( m_position );
180 long emitPos = (long)m_position; 179 long emitPos = (long)m_position;
181 emit positionChanged( emitPos ); 180 emit positionChanged( emitPos );
182 if( mediaPlayerState.isPlaying() ) { 181 if( mediaPlayerState.isPlaying() ) {
183 // needs to be stopped the media is stopped 182 // needs to be stopped the media is stopped
184 QTimer::singleShot( 1000, this, SLOT( position() ) ); 183 QTimer::singleShot( 1000, this, SLOT( position() ) );
185 } 184 }
186 // qDebug("POSITION : %d", m_position); 185 // qDebug("POSITION : %d", m_position);
187 return m_position; 186 return m_position;
188} 187}
189 188
190/** 189/**
191 * Set videoplayback to fullscreen 190 * Set videoplayback to fullscreen
192 * @param isSet 191 * @param isSet
193 */ 192 */
194void XineControl::setFullscreen( bool isSet ) { 193void XineControl::setFullscreen( bool isSet ) {
195 libXine->showVideoFullScreen( isSet ); 194 libXine->showVideoFullScreen( isSet );
196} 195}
197 196
198 197
199QString XineControl::getMetaInfo() { 198QString XineControl::getMetaInfo() {
200 199
201 QString returnString; 200 QString returnString;
202 201
203 if ( !libXine->metaInfo( 0 ).isEmpty() ) { 202 if ( !libXine->metaInfo( 0 ).isEmpty() ) {
204 returnString += tr( " Title: " + libXine->metaInfo( 0 ) ); 203 returnString += tr( " Title: " + libXine->metaInfo( 0 ) );
205 } 204 }
206 205
207 if ( !libXine->metaInfo( 1 ).isEmpty() ) { 206 if ( !libXine->metaInfo( 1 ).isEmpty() ) {
208 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) ); 207 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) );
209 } 208 }
210 209
211 if ( !libXine->metaInfo( 2 ).isEmpty() ) { 210 if ( !libXine->metaInfo( 2 ).isEmpty() ) {
212 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) ); 211 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) );
213 } 212 }
214 213
215 if ( !libXine->metaInfo( 3 ).isEmpty() ) { 214 if ( !libXine->metaInfo( 3 ).isEmpty() ) {
216 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) ); 215 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) );
217 } 216 }
218 217
219 if ( !libXine->metaInfo( 4 ).isEmpty() ) { 218 if ( !libXine->metaInfo( 4 ).isEmpty() ) {
220 returnString += tr( " Album: " + libXine->metaInfo( 4 ) ); 219 returnString += tr( " Album: " + libXine->metaInfo( 4 ) );
221 } 220 }
222 221
223 if ( !libXine->metaInfo( 5 ).isEmpty() ) { 222 if ( !libXine->metaInfo( 5 ).isEmpty() ) {
224 returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); 223 returnString += tr( " Year: " + libXine->metaInfo( 5 ) );
225 } 224 }
226 return returnString; 225 return returnString;
227} 226}
228 227
229QString XineControl::getErrorCode() { 228QString XineControl::getErrorCode() {
230 229
231 int errorCode = libXine->error(); 230 int errorCode = libXine->error();
232 231
233 qDebug( QString("ERRORCODE: %1 ").arg(errorCode) ); 232 qDebug( QString("ERRORCODE: %1 ").arg(errorCode) );
234 233
235 if ( errorCode == 1 ) { 234 if ( errorCode == 1 ) {
236 return tr( "No input plugin found for this media type" ); 235 return tr( "No input plugin found for this media type" );
237 } else if ( errorCode == 2 ) { 236 } else if ( errorCode == 2 ) {
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h
index 00486f2..24e966b 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.h
+++ b/noncore/multimedia/opieplayer2/xinecontrol.h
@@ -1,119 +1,123 @@
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#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 <qobject.h> 38#include <qobject.h>
39 39
40#include "mediaplayerstate.h" 40#include "mediaplayerstate.h"
41 41
42class VideoWidget;
43
42class XineControl : public QObject { 44class XineControl : public QObject {
43 Q_OBJECT 45 Q_OBJECT
44public: 46public:
45 XineControl( MediaPlayerState &_mediaPlayerState, QObject *parent = 0, const char *name =0 ); 47 XineControl( VideoWidget *videoWidget, MediaPlayerState &_mediaPlayerState, QObject *parent = 0, const char *name =0 );
46 ~XineControl(); 48 ~XineControl();
47 49
48 bool hasVideo() const { return hasVideoChannel; } 50 bool hasVideo() const { return hasVideoChannel; }
49 bool hasAudio() const { return hasAudioChannel; } 51 bool hasAudio() const { return hasAudioChannel; }
50 52
51public slots: 53public slots:
52 void play( const QString& fileName ); 54 void play( const QString& fileName );
53 void stop( bool ); 55 void stop( bool );
54 56
55 /** 57 /**
56 * Pause the media stream 58 * Pause the media stream
57 * @param if pause or not 59 * @param if pause or not
58 */ 60 */
59 void pause( bool ); 61 void pause( bool );
60 62
61 /** 63 /**
62 * Set videos fullscreen 64 * Set videos fullscreen
63 * @param yes or no 65 * @param yes or no
64 */ 66 */
65 void setFullscreen( bool ); 67 void setFullscreen( bool );
66 68
67 /** 69 /**
68 * 70 *
69 */ 71 */
70 long currentTime(); 72 long currentTime();
71 void seekTo( long ); 73 void seekTo( long );
72 // get length of media file and set it 74 // get length of media file and set it
73 void length(); 75 void length();
74 long position(); 76 long position();
75 77
76 /** 78 /**
77 * Proceed to the next media file in playlist 79 * Proceed to the next media file in playlist
78 */ 80 */
79 void nextMedia(); 81 void nextMedia();
80 82
81 /** 83 /**
82 * Get as much info about the stream from xine as possible 84 * Get as much info about the stream from xine as possible
83 */ 85 */
84 QString getMetaInfo(); 86 QString getMetaInfo();
85 87
86 /** 88 /**
87 * get the error code and "translate" it for the user 89 * get the error code and "translate" it for the user
88 * 90 *
89 */ 91 */
90 QString getErrorCode(); 92 QString getErrorCode();
91 93
92 94
93 void videoResized ( const QSize &s ); 95 void videoResized ( const QSize &s );
94 96
95 /** 97 /**
96 * Set the gamma value of the video output 98 * Set the gamma value of the video output
97 * @param int value between -100 and 100, 0 is original 99 * @param int value between -100 and 100, 0 is original
98 */ 100 */
99 void setGamma( int ); 101 void setGamma( int );
100 102
101 103
102private: 104private:
103 XINE::Lib *libXine; 105 XINE::Lib *libXine;
104 long m_currentTime; 106 long m_currentTime;
105 long m_position; 107 long m_position;
106 int m_length; 108 int m_length;
107 QString m_fileName; 109 QString m_fileName;
108 bool disabledSuspendScreenSaver : 1; 110 bool disabledSuspendScreenSaver : 1;
109 bool hasVideoChannel : 1; 111 bool hasVideoChannel : 1;
110 bool hasAudioChannel : 1; 112 bool hasAudioChannel : 1;
111 MediaPlayerState &mediaPlayerState; 113 MediaPlayerState &mediaPlayerState;
112 114
113signals: 115signals:
114 void positionChanged( long ); 116 void positionChanged( long );
115 117
118private:
119 VideoWidget *videoUI;
116}; 120};
117 121
118 122
119#endif 123#endif