summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-02 15:51:48 (UTC)
committer simon <simon>2002-12-02 15:51:48 (UTC)
commita0cfa5b76aac8de36304faef4bb2b14237c04c9a (patch) (unidiff)
tree0b427d07d918671065e6aed1682b108cda166ce7
parent9f770813346acbe7817b20c5fe0fea03827fc41a (diff)
downloadopie-a0cfa5b76aac8de36304faef4bb2b14237c04c9a.zip
opie-a0cfa5b76aac8de36304faef4bb2b14237c04c9a.tar.gz
opie-a0cfa5b76aac8de36304faef4bb2b14237c04c9a.tar.bz2
- simplified MediaPlayer::setPlaying, moving more switch() like code into
playlistwidget
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp31
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h1
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h15
4 files changed, 34 insertions, 25 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 6a38adc..74ab2e3 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,367 +1,354 @@
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; 27extern AudioWidget *audioUI;
28extern VideoWidget *videoUI; 28extern VideoWidget *videoUI;
29extern PlayListWidget *playList; 29extern PlayListWidget *playList;
30extern MediaPlayerState *mediaPlayerState; 30extern MediaPlayerState *mediaPlayerState;
31 31
32 32
33#define FBIOBLANK 0x4611 33#define FBIOBLANK 0x4611
34 34
35MediaPlayer::MediaPlayer( QObject *parent, const char *name ) 35MediaPlayer::MediaPlayer( QObject *parent, const char *name )
36 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { 36 : QObject( parent, name ), volumeDirection( 0 ) {
37 37
38 fd=-1;fl=-1; 38 fd=-1;fl=-1;
39 playList->setCaption( tr( "OpiePlayer: Initializating" ) ); 39 playList->setCaption( tr( "OpiePlayer: Initializating" ) );
40 40
41 qApp->processEvents(); 41 qApp->processEvents();
42 // QPEApplication::grabKeyboard(); // EVIL 42 // QPEApplication::grabKeyboard(); // EVIL
43 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 43 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
44 44
45 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 45 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
46 46
47 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 47 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
48 48
49 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 49 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
50 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 50 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
51 connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); 51 connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) );
52 52
53 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 53 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
54 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 54 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
55 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 55 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
56 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 56 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
57 57
58 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 58 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
59 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 59 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
60 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 60 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
61 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 61 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
62 62
63 volControl = new VolumeControl; 63 volControl = new VolumeControl;
64 xineControl = new XineControl(); 64 xineControl = new XineControl();
65 Config cfg( "OpiePlayer" ); 65 Config cfg( "OpiePlayer" );
66 cfg.setGroup("PlayList"); 66 cfg.setGroup("PlayList");
67 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 67 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
68 playList->setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); 68 playList->setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() );
69} 69}
70 70
71MediaPlayer::~MediaPlayer() { 71MediaPlayer::~MediaPlayer() {
72 delete xineControl; 72 delete xineControl;
73 delete volControl; 73 delete volControl;
74} 74}
75 75
76void MediaPlayer::pauseCheck( bool b ) { 76void MediaPlayer::pauseCheck( bool b ) {
77 if ( b && !mediaPlayerState->isPlaying() ) { 77 if ( b && !mediaPlayerState->isPlaying() ) {
78 mediaPlayerState->setPaused( FALSE ); 78 mediaPlayerState->setPaused( FALSE );
79 } 79 }
80} 80}
81 81
82void MediaPlayer::play() { 82void MediaPlayer::play() {
83 mediaPlayerState->setPlaying( FALSE ); 83 mediaPlayerState->setPlaying( FALSE );
84 mediaPlayerState->setPlaying( TRUE ); 84 mediaPlayerState->setPlaying( TRUE );
85} 85}
86 86
87void MediaPlayer::setPlaying( bool play ) { 87void MediaPlayer::setPlaying( bool play ) {
88 if ( !play ) { 88 if ( !play ) {
89 return; 89 return;
90 } 90 }
91 91
92 if ( mediaPlayerState->isPaused() ) { 92 if ( mediaPlayerState->isPaused() ) {
93 mediaPlayerState->setPaused( FALSE ); 93 mediaPlayerState->setPaused( FALSE );
94 return; 94 return;
95 } 95 }
96 96
97 QString tickerText, time, fileName; 97 QString tickerText, time, fileName;
98 if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //check for filelist 98 if ( playList->currentTab() != PlayListWidget::CurrentPlayList ) {
99 const DocLnk *playListCurrent = playList->current();
100 if ( playListCurrent != NULL ) {
101 currentFile = playListCurrent;
102 }
103 xineControl->play( currentFile->file() );
104 fileName = currentFile->name();
105 long seconds = mediaPlayerState->length();//
106 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
107 //qDebug(time);
108
109 } else {
110 //if playing in file list.. play in a different way 99 //if playing in file list.. play in a different way
111 // random and looping settings enabled causes problems here, 100 // random and looping settings enabled causes problems here,
112 // since there is no selected file in the playlist, but a selected file in the file list, 101 // since there is no selected file in the playlist, but a selected file in the file list,
113 // so we remember and shutoff 102 // so we remember and shutoff
114 l = mediaPlayerState->isLooping(); 103 l = mediaPlayerState->isLooping();
115 if(l) { 104 if(l) {
116 mediaPlayerState->setLooping( false ); 105 mediaPlayerState->setLooping( false );
117 } 106 }
118 r = mediaPlayerState->isShuffled(); 107 r = mediaPlayerState->isShuffled();
119 mediaPlayerState->setShuffled( false ); 108 mediaPlayerState->setShuffled( false );
109 }
120 110
121 fileName = playList->currentFileListPathName(); 111 PlayListWidget::Entry playListEntry = playList->currentEntry();
122 xineControl->play( fileName ); 112 fileName = playListEntry.name;
123 long seconds = mediaPlayerState->length(); 113 xineControl->play( playListEntry.file );
124 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
125 //qDebug(time);
126 if( fileName.left(4) != "http" ) {
127 fileName = QFileInfo( fileName ).baseName();
128 }
129 114
130 } 115 long seconds = mediaPlayerState->length();
116 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
131 117
132 if( fileName.left(4) == "http" ) { 118 if( fileName.left(4) == "http" ) {
119 fileName = QFileInfo( fileName ).baseName();
133 if ( xineControl->getMetaInfo().isEmpty() ) { 120 if ( xineControl->getMetaInfo().isEmpty() ) {
134 tickerText = tr( " File: " ) + fileName; 121 tickerText = tr( " File: " ) + fileName;
135 } else { 122 } else {
136 tickerText = xineControl->getMetaInfo(); 123 tickerText = xineControl->getMetaInfo();
137 } 124 }
138 } else { 125 } else {
139 if ( xineControl->getMetaInfo().isEmpty() ) { 126 if ( xineControl->getMetaInfo().isEmpty() ) {
140 tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; 127 tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " ";
141 } else { 128 } else {
142 tickerText = xineControl->getMetaInfo() + " Length: " + time + " "; 129 tickerText = xineControl->getMetaInfo() + " Length: " + time + " ";
143 } 130 }
144 } 131 }
145 audioUI->setTickerText( tickerText ); 132 audioUI->setTickerText( tickerText );
146} 133}
147 134
148 135
149void MediaPlayer::prev() { 136void MediaPlayer::prev() {
150 if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist 137 if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist
151 if ( playList->prev() ) { 138 if ( playList->prev() ) {
152 play(); 139 play();
153 } else if ( mediaPlayerState->isLooping() ) { 140 } else if ( mediaPlayerState->isLooping() ) {
154 if ( playList->last() ) { 141 if ( playList->last() ) {
155 play(); 142 play();
156 } 143 }
157 } else { 144 } else {
158 mediaPlayerState->setList(); 145 mediaPlayerState->setList();
159 } 146 }
160 } 147 }
161} 148}
162 149
163 150
164void MediaPlayer::next() { 151void MediaPlayer::next() {
165 152
166 if(playList->currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist 153 if(playList->currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist
167 if ( playList->next() ) { 154 if ( playList->next() ) {
168 play(); 155 play();
169 } else if ( mediaPlayerState->isLooping() ) { 156 } else if ( mediaPlayerState->isLooping() ) {
170 if ( playList->first() ) { 157 if ( playList->first() ) {
171 play(); 158 play();
172 } 159 }
173 } else { 160 } else {
174 mediaPlayerState->setList(); 161 mediaPlayerState->setList();
175 } 162 }
176 } else { //if playing from file list, let's just stop 163 } else { //if playing from file list, let's just stop
177 qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); 164 qDebug("<<<<<<<<<<<<<<<<<stop for filelists");
178 mediaPlayerState->setPlaying(false); 165 mediaPlayerState->setPlaying(false);
179 mediaPlayerState->setView('l'); 166 mediaPlayerState->setView('l');
180 if(l) mediaPlayerState->setLooping(l); 167 if(l) mediaPlayerState->setLooping(l);
181 if(r) mediaPlayerState->setShuffled(r); 168 if(r) mediaPlayerState->setShuffled(r);
182 } 169 }
183 qApp->processEvents(); 170 qApp->processEvents();
184} 171}
185 172
186 173
187void MediaPlayer::startDecreasingVolume() { 174void MediaPlayer::startDecreasingVolume() {
188 volumeDirection = -1; 175 volumeDirection = -1;
189 startTimer( 100 ); 176 startTimer( 100 );
190 volControl->decVol(2); 177 volControl->decVol(2);
191} 178}
192 179
193 180
194void MediaPlayer::startIncreasingVolume() { 181void MediaPlayer::startIncreasingVolume() {
195 volumeDirection = +1; 182 volumeDirection = +1;
196 startTimer( 100 ); 183 startTimer( 100 );
197 volControl->incVol(2); 184 volControl->incVol(2);
198} 185}
199 186
200 187
201bool drawnOnScreenDisplay = FALSE; 188bool drawnOnScreenDisplay = FALSE;
202unsigned int onScreenDisplayVolume = 0; 189unsigned int onScreenDisplayVolume = 0;
203const int yoff = 110; 190const int yoff = 110;
204 191
205void MediaPlayer::stopChangingVolume() { 192void MediaPlayer::stopChangingVolume() {
206 killTimers(); 193 killTimers();
207 // Get rid of the on-screen display stuff 194 // Get rid of the on-screen display stuff
208 drawnOnScreenDisplay = FALSE; 195 drawnOnScreenDisplay = FALSE;
209 onScreenDisplayVolume = 0; 196 onScreenDisplayVolume = 0;
210 int w=0; 197 int w=0;
211 int h=0; 198 int h=0;
212 if( !xineControl->hasVideo() ) { 199 if( !xineControl->hasVideo() ) {
213 w = audioUI->width(); 200 w = audioUI->width();
214 h = audioUI->height(); 201 h = audioUI->height();
215 audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); 202 audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE );
216 } else { 203 } else {
217 w = videoUI->width(); 204 w = videoUI->width();
218 h = videoUI->height(); 205 h = videoUI->height();
219 videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); 206 videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE );
220 } 207 }
221} 208}
222 209
223 210
224void MediaPlayer::timerEvent( QTimerEvent * ) { 211void MediaPlayer::timerEvent( QTimerEvent * ) {
225 if ( volumeDirection == +1 ) { 212 if ( volumeDirection == +1 ) {
226 volControl->incVol( 2 ); 213 volControl->incVol( 2 );
227 } else if ( volumeDirection == -1 ) { 214 } else if ( volumeDirection == -1 ) {
228 volControl->decVol( 2 ); 215 volControl->decVol( 2 );
229 } 216 }
230 217
231 218
232 // TODO FIXME 219 // TODO FIXME
233 // huh?? 220 // huh??
234 unsigned int v= 0; 221 unsigned int v= 0;
235 v = volControl->volume(); 222 v = volControl->volume();
236 v = v / 10; 223 v = v / 10;
237 224
238 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { 225 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) {
239 return; 226 return;
240 } 227 }
241 228
242 int w=0; int h=0; 229 int w=0; int h=0;
243 if( !xineControl->hasVideo() ) { 230 if( !xineControl->hasVideo() ) {
244 w = audioUI->width(); 231 w = audioUI->width();
245 h = audioUI->height(); 232 h = audioUI->height();
246 233
247 if ( drawnOnScreenDisplay ) { 234 if ( drawnOnScreenDisplay ) {
248 if ( onScreenDisplayVolume > v ) { 235 if ( onScreenDisplayVolume > v ) {
249 audioUI->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); 236 audioUI->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE );
250 } 237 }
251 } 238 }
252 drawnOnScreenDisplay = TRUE; 239 drawnOnScreenDisplay = TRUE;
253 onScreenDisplayVolume = v; 240 onScreenDisplayVolume = v;
254 QPainter p( audioUI ); 241 QPainter p( audioUI );
255 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 242 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
256 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 243 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
257 244
258 QFont f; 245 QFont f;
259 f.setPixelSize( 20 ); 246 f.setPixelSize( 20 );
260 f.setBold( TRUE ); 247 f.setBold( TRUE );
261 p.setFont( f ); 248 p.setFont( f );
262 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); 249 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") );
263 250
264 for ( unsigned int i = 0; i < 10; i++ ) { 251 for ( unsigned int i = 0; i < 10; i++ ) {
265 if ( v > i ) { 252 if ( v > i ) {
266 p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 253 p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
267 } else { 254 } else {
268 p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 255 p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
269 } 256 }
270 } 257 }
271 } else { 258 } else {
272 w = videoUI->width(); 259 w = videoUI->width();
273 h = videoUI->height(); 260 h = videoUI->height();
274 261
275 if ( drawnOnScreenDisplay ) { 262 if ( drawnOnScreenDisplay ) {
276 if ( onScreenDisplayVolume > v ) { 263 if ( onScreenDisplayVolume > v ) {
277 videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); 264 videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE );
278 } 265 }
279 } 266 }
280 drawnOnScreenDisplay = TRUE; 267 drawnOnScreenDisplay = TRUE;
281 onScreenDisplayVolume = v; 268 onScreenDisplayVolume = v;
282 QPainter p( videoUI ); 269 QPainter p( videoUI );
283 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 270 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
284 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 271 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
285 272
286 QFont f; 273 QFont f;
287 f.setPixelSize( 20 ); 274 f.setPixelSize( 20 );
288 f.setBold( TRUE ); 275 f.setBold( TRUE );
289 p.setFont( f ); 276 p.setFont( f );
290 p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); 277 p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) );
291 278
292 for ( unsigned int i = 0; i < 10; i++ ) { 279 for ( unsigned int i = 0; i < 10; i++ ) {
293 if ( v > i ) { 280 if ( v > i ) {
294 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 281 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
295 } else { 282 } else {
296 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 283 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
297 } 284 }
298 } 285 }
299 } 286 }
300} 287}
301 288
302 289
303void MediaPlayer::blank( bool b ) { 290void MediaPlayer::blank( bool b ) {
304 fd=open("/dev/fb0",O_RDWR); 291 fd=open("/dev/fb0",O_RDWR);
305#ifdef QT_QWS_EBX 292#ifdef QT_QWS_EBX
306 fl= open( "/dev/fl", O_RDWR ); 293 fl= open( "/dev/fl", O_RDWR );
307#endif 294#endif
308 if (fd != -1) { 295 if (fd != -1) {
309 if ( b ) { 296 if ( b ) {
310 qDebug("do blanking"); 297 qDebug("do blanking");
311#ifdef QT_QWS_EBX 298#ifdef QT_QWS_EBX
312 ioctl( fd, FBIOBLANK, 1 ); 299 ioctl( fd, FBIOBLANK, 1 );
313 if(fl !=-1) { 300 if(fl !=-1) {
314 ioctl( fl, 2 ); 301 ioctl( fl, 2 );
315 ::close(fl); 302 ::close(fl);
316 } 303 }
317#else 304#else
318 ioctl( fd, FBIOBLANK, 3 ); 305 ioctl( fd, FBIOBLANK, 3 );
319#endif 306#endif
320 isBlanked = TRUE; 307 isBlanked = TRUE;
321 } else { 308 } else {
322 qDebug("do unblanking"); 309 qDebug("do unblanking");
323 ioctl( fd, FBIOBLANK, 0); 310 ioctl( fd, FBIOBLANK, 0);
324#ifdef QT_QWS_EBX 311#ifdef QT_QWS_EBX
325 if(fl != -1) { 312 if(fl != -1) {
326 ioctl( fl, 1); 313 ioctl( fl, 1);
327 ::close(fl); 314 ::close(fl);
328 } 315 }
329#endif 316#endif
330 isBlanked = FALSE; 317 isBlanked = FALSE;
331 } 318 }
332 close( fd ); 319 close( fd );
333 } else { 320 } else {
334 qDebug("<< /dev/fb0 could not be opened >>"); 321 qDebug("<< /dev/fb0 could not be opened >>");
335 } 322 }
336} 323}
337 324
338void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 325void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
339 switch ( e->key() ) { 326 switch ( e->key() ) {
340////////////////////////////// Zaurus keys 327////////////////////////////// Zaurus keys
341 case Key_Home: 328 case Key_Home:
342 break; 329 break;
343 case Key_F9: //activity 330 case Key_F9: //activity
344 break; 331 break;
345 case Key_F10: //contacts 332 case Key_F10: //contacts
346 break; 333 break;
347 case Key_F11: //menu 334 case Key_F11: //menu
348 break; 335 break;
349 case Key_F12: //home 336 case Key_F12: //home
350 qDebug("Blank here"); 337 qDebug("Blank here");
351// mediaPlayerState->toggleBlank(); 338// mediaPlayerState->toggleBlank();
352 break; 339 break;
353 case Key_F13: //mail 340 case Key_F13: //mail
354 qDebug("Blank here"); 341 qDebug("Blank here");
355 // mediaPlayerState->toggleBlank(); 342 // mediaPlayerState->toggleBlank();
356 break; 343 break;
357 } 344 }
358} 345}
359 346
360void MediaPlayer::cleanUp() {// this happens on closing 347void MediaPlayer::cleanUp() {// this happens on closing
361 Config cfg( "OpiePlayer" ); 348 Config cfg( "OpiePlayer" );
362 mediaPlayerState->writeConfig( cfg ); 349 mediaPlayerState->writeConfig( cfg );
363 playList->writeDefaultPlaylist( ); 350 playList->writeDefaultPlaylist( );
364 351
365// QPEApplication::grabKeyboard(); 352// QPEApplication::grabKeyboard();
366// QPEApplication::ungrabKeyboard(); 353// QPEApplication::ungrabKeyboard();
367} 354}
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h
index 002311a..1e34c88 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.h
+++ b/noncore/multimedia/opieplayer2/mediaplayer.h
@@ -1,78 +1,77 @@
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#include <qpe/qlibrary.h> 39#include <qpe/qlibrary.h>
40#include <qpe/mediaplayerplugininterface.h> 40#include <qpe/mediaplayerplugininterface.h>
41 41
42#include "xinecontrol.h" 42#include "xinecontrol.h"
43 43
44class DocLnk; 44class DocLnk;
45class VolumeControl; 45class VolumeControl;
46 46
47class MediaPlayer : public QObject { 47class MediaPlayer : public QObject {
48 Q_OBJECT 48 Q_OBJECT
49public: 49public:
50 MediaPlayer( QObject *parent, const char *name ); 50 MediaPlayer( QObject *parent, const char *name );
51 ~MediaPlayer(); 51 ~MediaPlayer();
52private slots: 52private slots:
53 void setPlaying( bool ); 53 void setPlaying( bool );
54 void pauseCheck( bool ); 54 void pauseCheck( bool );
55 void play(); 55 void play();
56 void next(); 56 void next();
57 void prev(); 57 void prev();
58 void startIncreasingVolume(); 58 void startIncreasingVolume();
59 void startDecreasingVolume(); 59 void startDecreasingVolume();
60 void stopChangingVolume(); 60 void stopChangingVolume();
61 void cleanUp(); 61 void cleanUp();
62 void blank( bool ); 62 void blank( bool );
63 63
64protected: 64protected:
65 void timerEvent( QTimerEvent *e ); 65 void timerEvent( QTimerEvent *e );
66 void keyReleaseEvent( QKeyEvent *e); 66 void keyReleaseEvent( QKeyEvent *e);
67private: 67private:
68 bool isBlanked, l, r; 68 bool isBlanked, l, r;
69 int fd, fl; 69 int fd, fl;
70 int volumeDirection; 70 int volumeDirection;
71 const DocLnk *currentFile;
72 XineControl *xineControl; 71 XineControl *xineControl;
73 VolumeControl *volControl; 72 VolumeControl *volControl;
74}; 73};
75 74
76 75
77#endif // MEDIA_PLAYER_H 76#endif // MEDIA_PLAYER_H
78 77
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index fd256b7..ce73252 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -1,1146 +1,1156 @@
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#include <qpe/qpetoolbar.h> 34#include <qpe/qpetoolbar.h>
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#include <qpe/storage.h> 36#include <qpe/storage.h>
37#include <qpe/mimetype.h> 37#include <qpe/mimetype.h>
38#include <qpe/global.h> 38#include <qpe/global.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40 40
41#include <qdatetime.h> 41#include <qdatetime.h>
42#include <qdir.h> 42#include <qdir.h>
43#include <qmessagebox.h> 43#include <qmessagebox.h>
44#include <qregexp.h> 44#include <qregexp.h>
45#include <qtextstream.h> 45#include <qtextstream.h>
46 46
47#include "playlistselection.h" 47#include "playlistselection.h"
48#include "playlistwidget.h" 48#include "playlistwidget.h"
49#include "mediaplayerstate.h" 49#include "mediaplayerstate.h"
50#include "inputDialog.h" 50#include "inputDialog.h"
51#include "om3u.h" 51#include "om3u.h"
52 52
53//only needed for the random play 53//only needed for the random play
54#include <stdlib.h> 54#include <stdlib.h>
55#include <assert.h> 55#include <assert.h>
56 56
57#include "audiowidget.h" 57#include "audiowidget.h"
58#include "videowidget.h" 58#include "videowidget.h"
59 59
60extern MediaPlayerState *mediaPlayerState; 60extern MediaPlayerState *mediaPlayerState;
61// extern AudioWidget *audioUI; 61// extern AudioWidget *audioUI;
62// extern VideoWidget *videoUI; 62// extern VideoWidget *videoUI;
63 63
64QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; 64QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg";
65// no m3u's here please 65// no m3u's here please
66 66
67PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 67PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
68 : PlayListWidgetGui( parent, name, fl ) { 68 : PlayListWidgetGui( parent, name, fl ) {
69 69
70 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), 70 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
71 "opieplayer2/add_to_playlist", 71 "opieplayer2/add_to_playlist",
72 this , SLOT(addSelected() ) ); 72 this , SLOT(addSelected() ) );
73 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), 73 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
74 "opieplayer2/remove_from_playlist", 74 "opieplayer2/remove_from_playlist",
75 this , SLOT(removeSelected() ) ); 75 this , SLOT(removeSelected() ) );
76 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 76 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
77 this , SLOT( btnPlay( bool) ), TRUE ); 77 this , SLOT( btnPlay( bool) ), TRUE );
78 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 78 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
79 mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); 79 mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
80 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", 80 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
81 mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); 81 mediaPlayerState, SLOT( setLooping( bool ) ), TRUE );
82 82
83 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 83 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
84 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), 84 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
85 this, SLOT( addAllMusicToList() ) ); 85 this, SLOT( addAllMusicToList() ) );
86 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), 86 (void)new MenuItem( pmPlayList, tr( "Add all video files" ),
87 this, SLOT( addAllVideoToList() ) ); 87 this, SLOT( addAllVideoToList() ) );
88 (void)new MenuItem( pmPlayList, tr( "Add all files" ), 88 (void)new MenuItem( pmPlayList, tr( "Add all files" ),
89 this, SLOT( addAllToList() ) ); 89 this, SLOT( addAllToList() ) );
90 pmPlayList->insertSeparator(-1); 90 pmPlayList->insertSeparator(-1);
91// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), 91// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ),
92// this, SLOT( saveList() ) ); 92// this, SLOT( saveList() ) );
93 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), 93 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ),
94 this, SLOT(writem3u() ) ); 94 this, SLOT(writem3u() ) );
95 pmPlayList->insertSeparator(-1); 95 pmPlayList->insertSeparator(-1);
96 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), 96 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ),
97 this,SLOT( openFile() ) ); 97 this,SLOT( openFile() ) );
98 pmPlayList->insertSeparator(-1); 98 pmPlayList->insertSeparator(-1);
99 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), 99 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
100 this,SLOT( scanForAudio() ) ); 100 this,SLOT( scanForAudio() ) );
101 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), 101 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
102 this,SLOT( scanForVideo() ) ); 102 this,SLOT( scanForVideo() ) );
103 103
104 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), 104 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"),
105 mediaPlayerState, SLOT( toggleFullscreen() ) ); 105 mediaPlayerState, SLOT( toggleFullscreen() ) );
106 106
107 Config cfg( "OpiePlayer" ); 107 Config cfg( "OpiePlayer" );
108 bool b= cfg.readBoolEntry("FullScreen", 0); 108 bool b= cfg.readBoolEntry("FullScreen", 0);
109 mediaPlayerState->setFullscreen( b ); 109 mediaPlayerState->setFullscreen( b );
110 pmView->setItemChecked( -16, b ); 110 pmView->setItemChecked( -16, b );
111 111
112 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", 112 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up",
113 d->selectedFiles, SLOT(moveSelectedUp() ) ); 113 d->selectedFiles, SLOT(moveSelectedUp() ) );
114 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", 114 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut",
115 d->selectedFiles, SLOT(removeSelected() ) ); 115 d->selectedFiles, SLOT(removeSelected() ) );
116 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", 116 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down",
117 d->selectedFiles, SLOT(moveSelectedDown() ) ); 117 d->selectedFiles, SLOT(moveSelectedDown() ) );
118 // QVBox *stretch2 = new QVBox( vbox1 ); 118 // QVBox *stretch2 = new QVBox( vbox1 );
119 119
120 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), 120 connect( tbDeletePlaylist, ( SIGNAL( released() ) ),
121 SLOT( deletePlaylist() ) ); 121 SLOT( deletePlaylist() ) );
122 connect( pmView, SIGNAL( activated( int ) ), 122 connect( pmView, SIGNAL( activated( int ) ),
123 this, SLOT( pmViewActivated( int ) ) ); 123 this, SLOT( pmViewActivated( int ) ) );
124 connect( skinsMenu, SIGNAL( activated( int ) ) , 124 connect( skinsMenu, SIGNAL( activated( int ) ) ,
125 this, SLOT( skinsMenuActivated( int ) ) ); 125 this, SLOT( skinsMenuActivated( int ) ) );
126 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 126 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
127 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 127 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) );
128 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), 128 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ),
129 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 129 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) );
130 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), 130 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ),
131 this,SLOT( playIt( QListViewItem *) ) ); 131 this,SLOT( playIt( QListViewItem *) ) );
132 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), 132 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ),
133 this, SLOT( addToSelection( QListViewItem *) ) ); 133 this, SLOT( addToSelection( QListViewItem *) ) );
134 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 134 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
135 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); 135 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) );
136 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), 136 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ),
137 this,SLOT( playIt( QListViewItem *) ) ); 137 this,SLOT( playIt( QListViewItem *) ) );
138 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), 138 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ),
139 this, SLOT( addToSelection( QListViewItem *) ) ); 139 this, SLOT( addToSelection( QListViewItem *) ) );
140 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), 140 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ),
141 this, SLOT( loadList( const DocLnk & ) ) ); 141 this, SLOT( loadList( const DocLnk & ) ) );
142 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), 142 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ),
143 this, SLOT( tabChanged( QWidget* ) ) ); 143 this, SLOT( tabChanged( QWidget* ) ) );
144 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), 144 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ),
145 d->tbPlay, SLOT( setOn( bool ) ) ); 145 d->tbPlay, SLOT( setOn( bool ) ) );
146 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), 146 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ),
147 d->tbLoop, SLOT( setOn( bool ) ) ); 147 d->tbLoop, SLOT( setOn( bool ) ) );
148 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), 148 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ),
149 d->tbShuffle, SLOT( setOn( bool ) ) ); 149 d->tbShuffle, SLOT( setOn( bool ) ) );
150 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), 150 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ),
151 this, SLOT( setPlaylist( bool ) ) ); 151 this, SLOT( setPlaylist( bool ) ) );
152 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), 152 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ),
153 this, SLOT( playIt( QListViewItem *) ) ); 153 this, SLOT( playIt( QListViewItem *) ) );
154 connect ( gammaSlider, SIGNAL( valueChanged( int ) ), 154 connect ( gammaSlider, SIGNAL( valueChanged( int ) ),
155 mediaPlayerState, SLOT( setVideoGamma( int ) ) ); 155 mediaPlayerState, SLOT( setVideoGamma( int ) ) );
156 156
157 // see which skins are installed 157 // see which skins are installed
158 videoScan=false; 158 videoScan=false;
159 audioScan=false; 159 audioScan=false;
160 audioPopulated=false; 160 audioPopulated=false;
161 videoPopulated=false; 161 videoPopulated=false;
162 populateSkinsMenu(); 162 populateSkinsMenu();
163 initializeStates(); 163 initializeStates();
164 164
165 cfg.setGroup("PlayList"); 165 cfg.setGroup("PlayList");
166 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 166 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
167 loadList(DocLnk( currentPlaylist ) ); 167 loadList(DocLnk( currentPlaylist ) );
168} 168}
169 169
170 170
171PlayListWidget::~PlayListWidget() { 171PlayListWidget::~PlayListWidget() {
172 if ( d->current ) { 172 if ( d->current ) {
173 delete d->current; 173 delete d->current;
174 } 174 }
175 delete d; 175 delete d;
176} 176}
177 177
178 178
179void PlayListWidget::initializeStates() { 179void PlayListWidget::initializeStates() {
180 d->tbPlay->setOn( mediaPlayerState->isPlaying() ); 180 d->tbPlay->setOn( mediaPlayerState->isPlaying() );
181 d->tbLoop->setOn( mediaPlayerState->isLooping() ); 181 d->tbLoop->setOn( mediaPlayerState->isLooping() );
182 d->tbShuffle->setOn( mediaPlayerState->isShuffled() ); 182 d->tbShuffle->setOn( mediaPlayerState->isShuffled() );
183 setPlaylist( true ); 183 setPlaylist( true );
184} 184}
185 185
186void PlayListWidget::writeDefaultPlaylist() { 186void PlayListWidget::writeDefaultPlaylist() {
187 187
188 Config config( "OpiePlayer" ); 188 Config config( "OpiePlayer" );
189 config.setGroup( "PlayList" ); 189 config.setGroup( "PlayList" );
190 QString filename=QPEApplication::documentDir() + "/default.m3u"; 190 QString filename=QPEApplication::documentDir() + "/default.m3u";
191 QString currentString = config.readEntry( "CurrentPlaylist", filename); 191 QString currentString = config.readEntry( "CurrentPlaylist", filename);
192 if( currentString == filename) { 192 if( currentString == filename) {
193 Om3u *m3uList; 193 Om3u *m3uList;
194 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); 194 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>");
195 if( d->selectedFiles->first() ) { 195 if( d->selectedFiles->first() ) {
196 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); 196 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
197 do { 197 do {
198 // qDebug(d->selectedFiles->current()->file()); 198 // qDebug(d->selectedFiles->current()->file());
199 m3uList->add( d->selectedFiles->current()->file() ); 199 m3uList->add( d->selectedFiles->current()->file() );
200 } 200 }
201 while ( d->selectedFiles->next() ); 201 while ( d->selectedFiles->next() );
202 202
203 m3uList->write(); 203 m3uList->write();
204 m3uList->close(); 204 m3uList->close();
205 if(m3uList) delete m3uList; 205 if(m3uList) delete m3uList;
206 206
207 } 207 }
208 } 208 }
209} 209}
210 210
211void PlayListWidget::addToSelection( const DocLnk& lnk ) { 211void PlayListWidget::addToSelection( const DocLnk& lnk ) {
212 d->setDocumentUsed = FALSE; 212 d->setDocumentUsed = FALSE;
213 if ( mediaPlayerState->isUsingPlaylist() ) { 213 if ( mediaPlayerState->isUsingPlaylist() ) {
214 if( QFileInfo( lnk.file() ).exists() || 214 if( QFileInfo( lnk.file() ).exists() ||
215 lnk.file().left(4) == "http" ) { 215 lnk.file().left(4) == "http" ) {
216 d->selectedFiles->addToSelection( lnk ); 216 d->selectedFiles->addToSelection( lnk );
217 } 217 }
218// writeCurrentM3u(); 218// writeCurrentM3u();
219 } 219 }
220 else 220 else
221 mediaPlayerState->setPlaying( TRUE ); 221 mediaPlayerState->setPlaying( TRUE );
222} 222}
223 223
224 224
225void PlayListWidget::clearList() { 225void PlayListWidget::clearList() {
226 while ( first() ) { 226 while ( first() ) {
227 d->selectedFiles->removeSelected(); 227 d->selectedFiles->removeSelected();
228 } 228 }
229} 229}
230 230
231void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { 231void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) {
232 switch (mouse) { 232 switch (mouse) {
233 case 1: 233 case 1:
234 break; 234 break;
235 case 2: 235 case 2:
236 { 236 {
237 QPopupMenu m; 237 QPopupMenu m;
238 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 238 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
239 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 239 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
240 m.exec( QCursor::pos() ); 240 m.exec( QCursor::pos() );
241 } 241 }
242 break; 242 break;
243 } 243 }
244} 244}
245 245
246 246
247void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { 247void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) {
248 switch (mouse) { 248 switch (mouse) {
249 case 1: 249 case 1:
250 break; 250 break;
251 case 2: 251 case 2:
252 { 252 {
253 QPopupMenu m; 253 QPopupMenu m;
254 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 254 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
255 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 255 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
256 m.exec( QCursor::pos() ); 256 m.exec( QCursor::pos() );
257 } 257 }
258 break; 258 break;
259 } 259 }
260} 260}
261 261
262 262
263void PlayListWidget::addAllToList() { 263void PlayListWidget::addAllToList() {
264 264
265// QTime t; 265// QTime t;
266// t.start(); 266// t.start();
267 267
268 if(!audioScan) { 268 if(!audioScan) {
269 if(audioView->childCount() < 1) 269 if(audioView->childCount() < 1)
270 populateAudioView(); 270 populateAudioView();
271 } 271 }
272 272
273 QListViewItemIterator audioIt( audioView ); 273 QListViewItemIterator audioIt( audioView );
274 DocLnk lnk; 274 DocLnk lnk;
275 QString filename; 275 QString filename;
276 // iterate through all items of the listview 276 // iterate through all items of the listview
277 for ( ; audioIt.current(); ++audioIt ) { 277 for ( ; audioIt.current(); ++audioIt ) {
278 filename = audioIt.current()->text(3); 278 filename = audioIt.current()->text(3);
279 lnk.setName( QFileInfo(filename).baseName() ); //sets name 279 lnk.setName( QFileInfo(filename).baseName() ); //sets name
280 lnk.setFile( filename ); //sets file name 280 lnk.setFile( filename ); //sets file name
281 d->selectedFiles->addToSelection( lnk); 281 d->selectedFiles->addToSelection( lnk);
282 } 282 }
283 283
284 if(!videoScan) { 284 if(!videoScan) {
285 if(videoView->childCount() < 1) 285 if(videoView->childCount() < 1)
286 populateVideoView(); 286 populateVideoView();
287 } 287 }
288 288
289 QListViewItemIterator videoIt( videoView ); 289 QListViewItemIterator videoIt( videoView );
290 for ( ; videoIt.current(); ++videoIt ) { 290 for ( ; videoIt.current(); ++videoIt ) {
291 filename = videoIt.current()->text(3); 291 filename = videoIt.current()->text(3);
292 lnk.setName( QFileInfo(filename).baseName() ); //sets name 292 lnk.setName( QFileInfo(filename).baseName() ); //sets name
293 lnk.setFile( filename ); //sets file name 293 lnk.setFile( filename ); //sets file name
294 d->selectedFiles->addToSelection( lnk); 294 d->selectedFiles->addToSelection( lnk);
295 } 295 }
296 296
297 // d->selectedFiles->addToSelection( ); 297 // d->selectedFiles->addToSelection( );
298 // if ( it.current()->isSelected() ) 298 // if ( it.current()->isSelected() )
299 // lst->append( audioIt.current() ); 299 // lst->append( audioIt.current() );
300 // } 300 // }
301 301
302 302
303// if(!audioScan) 303// if(!audioScan)
304// scanForAudio(); 304// scanForAudio();
305// if(!videoScan) 305// if(!videoScan)
306// scanForVideo(); 306// scanForVideo();
307 307
308// DocLnkSet filesAll; 308// DocLnkSet filesAll;
309// Global::findDocuments(&filesAll, "video/*;"+audioMimes); 309// Global::findDocuments(&filesAll, "video/*;"+audioMimes);
310// QListIterator<DocLnk> Adit( filesAll.children() ); 310// QListIterator<DocLnk> Adit( filesAll.children() );
311// for ( ; Adit.current(); ++Adit ) { 311// for ( ; Adit.current(); ++Adit ) {
312// if( QFileInfo( Adit.current()->file() ).exists() ) { 312// if( QFileInfo( Adit.current()->file() ).exists() ) {
313// d->selectedFiles->addToSelection( **Adit ); 313// d->selectedFiles->addToSelection( **Adit );
314// } 314// }
315// } 315// }
316 316
317 // qDebug("elapsed time %d", t.elapsed() ); 317 // qDebug("elapsed time %d", t.elapsed() );
318 318
319 tabWidget->setCurrentPage(0); 319 tabWidget->setCurrentPage(0);
320 320
321 writeCurrentM3u(); 321 writeCurrentM3u();
322 d->selectedFiles->first(); 322 d->selectedFiles->first();
323} 323}
324 324
325 325
326void PlayListWidget::addAllMusicToList() { 326void PlayListWidget::addAllMusicToList() {
327 327
328 if(!audioScan) { 328 if(!audioScan) {
329 if(audioView->childCount() < 1) 329 if(audioView->childCount() < 1)
330 populateAudioView(); 330 populateAudioView();
331 } 331 }
332 332
333 QListViewItemIterator audioIt( audioView ); 333 QListViewItemIterator audioIt( audioView );
334 DocLnk lnk; 334 DocLnk lnk;
335 QString filename; 335 QString filename;
336 // iterate through all items of the listview 336 // iterate through all items of the listview
337 for ( ; audioIt.current(); ++audioIt ) { 337 for ( ; audioIt.current(); ++audioIt ) {
338 filename = audioIt.current()->text(3); 338 filename = audioIt.current()->text(3);
339 lnk.setName( QFileInfo(filename).baseName() ); //sets name 339 lnk.setName( QFileInfo(filename).baseName() ); //sets name
340 lnk.setFile( filename ); //sets file name 340 lnk.setFile( filename ); //sets file name
341 d->selectedFiles->addToSelection( lnk); 341 d->selectedFiles->addToSelection( lnk);
342 } 342 }
343 343
344 /* if(!audioScan) 344 /* if(!audioScan)
345 scanForAudio(); 345 scanForAudio();
346 QListIterator<DocLnk> dit( files.children() ); 346 QListIterator<DocLnk> dit( files.children() );
347 for ( ; dit.current(); ++dit ) { 347 for ( ; dit.current(); ++dit ) {
348 if( QFileInfo(dit.current()->file() ).exists() ) { 348 if( QFileInfo(dit.current()->file() ).exists() ) {
349 d->selectedFiles->addToSelection( **dit ); 349 d->selectedFiles->addToSelection( **dit );
350 } 350 }
351 } 351 }
352 */ 352 */
353 tabWidget->setCurrentPage(0); 353 tabWidget->setCurrentPage(0);
354 writeCurrentM3u(); 354 writeCurrentM3u();
355 d->selectedFiles->first(); 355 d->selectedFiles->first();
356} 356}
357 357
358 358
359void PlayListWidget::addAllVideoToList() { 359void PlayListWidget::addAllVideoToList() {
360 360
361 if(!videoScan) { 361 if(!videoScan) {
362 if(videoView->childCount() < 1) 362 if(videoView->childCount() < 1)
363 populateVideoView(); 363 populateVideoView();
364 } 364 }
365 365
366 QListViewItemIterator videoIt( videoView ); 366 QListViewItemIterator videoIt( videoView );
367 DocLnk lnk; 367 DocLnk lnk;
368 QString filename; 368 QString filename;
369 for ( ; videoIt.current(); ++videoIt ) { 369 for ( ; videoIt.current(); ++videoIt ) {
370 filename = videoIt.current()->text(3); 370 filename = videoIt.current()->text(3);
371 lnk.setName( QFileInfo(filename).baseName() ); //sets name 371 lnk.setName( QFileInfo(filename).baseName() ); //sets name
372 lnk.setFile( filename ); //sets file name 372 lnk.setFile( filename ); //sets file name
373 d->selectedFiles->addToSelection( lnk); 373 d->selectedFiles->addToSelection( lnk);
374 } 374 }
375 375
376 376
377 /* if(!videoScan) 377 /* if(!videoScan)
378 scanForVideo(); 378 scanForVideo();
379 QListIterator<DocLnk> dit( vFiles.children() ); 379 QListIterator<DocLnk> dit( vFiles.children() );
380 for ( ; dit.current(); ++dit ) { 380 for ( ; dit.current(); ++dit ) {
381 if( QFileInfo( dit.current()->file() ).exists() ) { 381 if( QFileInfo( dit.current()->file() ).exists() ) {
382 d->selectedFiles->addToSelection( **dit ); 382 d->selectedFiles->addToSelection( **dit );
383 } 383 }
384 } 384 }
385*/ 385*/
386 tabWidget->setCurrentPage(0); 386 tabWidget->setCurrentPage(0);
387 writeCurrentM3u(); 387 writeCurrentM3u();
388 d->selectedFiles->first(); 388 d->selectedFiles->first();
389} 389}
390 390
391 391
392void PlayListWidget::setDocument( const QString& fileref ) { 392void PlayListWidget::setDocument( const QString& fileref ) {
393 // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); 393 // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref );
394 fromSetDocument = TRUE; 394 fromSetDocument = TRUE;
395 if ( fileref.isNull() ) { 395 if ( fileref.isNull() ) {
396 QMessageBox::warning( this, tr( "Invalid File" ), 396 QMessageBox::warning( this, tr( "Invalid File" ),
397 tr( "There was a problem in getting the file." ) ); 397 tr( "There was a problem in getting the file." ) );
398 return; 398 return;
399 } 399 }
400 400
401 clearList(); 401 clearList();
402 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u 402 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u
403 readm3u( fileref ); 403 readm3u( fileref );
404 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { 404 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) {
405 readm3u( DocLnk( fileref).file() ); 405 readm3u( DocLnk( fileref).file() );
406 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls 406 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls
407 readPls( fileref ); 407 readPls( fileref );
408 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { 408 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) {
409 readPls( DocLnk( fileref).file() ); 409 readPls( DocLnk( fileref).file() );
410 } else { 410 } else {
411 clearList(); 411 clearList();
412 addToSelection( DocLnk( fileref ) ); 412 addToSelection( DocLnk( fileref ) );
413 writeCurrentM3u(); 413 writeCurrentM3u();
414 414
415 d->setDocumentUsed = TRUE; 415 d->setDocumentUsed = TRUE;
416 mediaPlayerState->setPlaying( FALSE ); 416 mediaPlayerState->setPlaying( FALSE );
417 mediaPlayerState->setPlaying( TRUE ); 417 mediaPlayerState->setPlaying( TRUE );
418 } 418 }
419} 419}
420 420
421 421
422void PlayListWidget::useSelectedDocument() { 422void PlayListWidget::useSelectedDocument() {
423 d->setDocumentUsed = FALSE; 423 d->setDocumentUsed = FALSE;
424} 424}
425 425
426 426
427const DocLnk *PlayListWidget::current() { // this is fugly 427const DocLnk *PlayListWidget::current() const { // this is fugly
428 assert( currentTab() == CurrentPlayList ); 428 assert( currentTab() == CurrentPlayList );
429 429
430// qDebug("playlist"); 430// qDebug("playlist");
431 if ( mediaPlayerState->isUsingPlaylist() ) { 431 if ( mediaPlayerState->isUsingPlaylist() ) {
432 return d->selectedFiles->current(); 432 return d->selectedFiles->current();
433 } else if ( d->setDocumentUsed && d->current ) { 433 } else if ( d->setDocumentUsed && d->current ) {
434 return d->current; 434 return d->current;
435 } else { 435 } else {
436 return &(d->files->selectedDocument()); 436 return &(d->files->selectedDocument());
437 } 437 }
438} 438}
439 439
440 440
441bool PlayListWidget::prev() { 441bool PlayListWidget::prev() {
442 if ( mediaPlayerState->isUsingPlaylist() ) { 442 if ( mediaPlayerState->isUsingPlaylist() ) {
443 if ( mediaPlayerState->isShuffled() ) { 443 if ( mediaPlayerState->isShuffled() ) {
444 const DocLnk *cur = current(); 444 const DocLnk *cur = current();
445 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 445 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
446 for ( int i = 0; i < j; i++ ) { 446 for ( int i = 0; i < j; i++ ) {
447 if ( !d->selectedFiles->next() ) 447 if ( !d->selectedFiles->next() )
448 d->selectedFiles->first(); 448 d->selectedFiles->first();
449 } 449 }
450 if ( cur == current() ) 450 if ( cur == current() )
451 if ( !d->selectedFiles->next() ) { 451 if ( !d->selectedFiles->next() ) {
452 d->selectedFiles->first(); 452 d->selectedFiles->first();
453 } 453 }
454 return TRUE; 454 return TRUE;
455 } else { 455 } else {
456 if ( !d->selectedFiles->prev() ) { 456 if ( !d->selectedFiles->prev() ) {
457 if ( mediaPlayerState->isLooping() ) { 457 if ( mediaPlayerState->isLooping() ) {
458 return d->selectedFiles->last(); 458 return d->selectedFiles->last();
459 } else { 459 } else {
460 return FALSE; 460 return FALSE;
461 } 461 }
462 } 462 }
463 return TRUE; 463 return TRUE;
464 } 464 }
465 } else { 465 } else {
466 return mediaPlayerState->isLooping(); 466 return mediaPlayerState->isLooping();
467 } 467 }
468} 468}
469 469
470 470
471bool PlayListWidget::next() { 471bool PlayListWidget::next() {
472//qDebug("<<<<<<<<<<<<next()"); 472//qDebug("<<<<<<<<<<<<next()");
473 if ( mediaPlayerState->isUsingPlaylist() ) { 473 if ( mediaPlayerState->isUsingPlaylist() ) {
474 if ( mediaPlayerState->isShuffled() ) { 474 if ( mediaPlayerState->isShuffled() ) {
475 return prev(); 475 return prev();
476 } else { 476 } else {
477 if ( !d->selectedFiles->next() ) { 477 if ( !d->selectedFiles->next() ) {
478 if ( mediaPlayerState->isLooping() ) { 478 if ( mediaPlayerState->isLooping() ) {
479 return d->selectedFiles->first(); 479 return d->selectedFiles->first();
480 } else { 480 } else {
481 return FALSE; 481 return FALSE;
482 } 482 }
483 } 483 }
484 return TRUE; 484 return TRUE;
485 } 485 }
486 } else { 486 } else {
487 return mediaPlayerState->isLooping(); 487 return mediaPlayerState->isLooping();
488 } 488 }
489} 489}
490 490
491 491
492bool PlayListWidget::first() { 492bool PlayListWidget::first() {
493 if ( mediaPlayerState->isUsingPlaylist() ) 493 if ( mediaPlayerState->isUsingPlaylist() )
494 return d->selectedFiles->first(); 494 return d->selectedFiles->first();
495 else 495 else
496 return mediaPlayerState->isLooping(); 496 return mediaPlayerState->isLooping();
497} 497}
498 498
499 499
500bool PlayListWidget::last() { 500bool PlayListWidget::last() {
501 if ( mediaPlayerState->isUsingPlaylist() ) 501 if ( mediaPlayerState->isUsingPlaylist() )
502 return d->selectedFiles->last(); 502 return d->selectedFiles->last();
503 else 503 else
504 return mediaPlayerState->isLooping(); 504 return mediaPlayerState->isLooping();
505} 505}
506 506
507 507
508 void PlayListWidget::saveList() { 508 void PlayListWidget::saveList() {
509 writem3u(); 509 writem3u();
510 } 510 }
511 511
512 512
513void PlayListWidget::loadList( const DocLnk & lnk) { 513void PlayListWidget::loadList( const DocLnk & lnk) {
514 QString name = lnk.name(); 514 QString name = lnk.name();
515 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); 515 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
516 516
517 if( name.length()>0) { 517 if( name.length()>0) {
518 setCaption("OpiePlayer: "+name); 518 setCaption("OpiePlayer: "+name);
519// qDebug("<<<<<<<<<<<<load list "+ lnk.file()); 519// qDebug("<<<<<<<<<<<<load list "+ lnk.file());
520 clearList(); 520 clearList();
521 readm3u(lnk.file()); 521 readm3u(lnk.file());
522 tabWidget->setCurrentPage(0); 522 tabWidget->setCurrentPage(0);
523 } 523 }
524} 524}
525 525
526 526
527void PlayListWidget::setPlaylist( bool shown ) { 527void PlayListWidget::setPlaylist( bool shown ) {
528 if ( shown ) { 528 if ( shown ) {
529 d->playListFrame->show(); 529 d->playListFrame->show();
530 } else { 530 } else {
531 d->playListFrame->hide(); 531 d->playListFrame->hide();
532 } 532 }
533} 533}
534 534
535 535
536void PlayListWidget::addSelected() { 536void PlayListWidget::addSelected() {
537 assert( inFileListMode() ); 537 assert( inFileListMode() );
538 538
539 QListView *fileListView = currentFileListView(); 539 QListView *fileListView = currentFileListView();
540 QListViewItemIterator it( fileListView ); 540 QListViewItemIterator it( fileListView );
541 for ( ; it.current(); ++it ) 541 for ( ; it.current(); ++it )
542 if ( it.current()->isSelected() ) { 542 if ( it.current()->isSelected() ) {
543 QString filename = it.current()->text(3); 543 QString filename = it.current()->text(3);
544 544
545 DocLnk lnk; 545 DocLnk lnk;
546 lnk.setName( QFileInfo( filename ).baseName() ); //sets name 546 lnk.setName( QFileInfo( filename ).baseName() ); //sets name
547 lnk.setFile( filename ); //sets file name 547 lnk.setFile( filename ); //sets file name
548 548
549 d->selectedFiles->addToSelection( lnk ); 549 d->selectedFiles->addToSelection( lnk );
550 } 550 }
551 551
552 fileListView->clearSelection(); 552 fileListView->clearSelection();
553 553
554 tabWidget->setCurrentPage( 0 ); 554 tabWidget->setCurrentPage( 0 );
555 writeCurrentM3u(); 555 writeCurrentM3u();
556} 556}
557 557
558 558
559void PlayListWidget::removeSelected() { 559void PlayListWidget::removeSelected() {
560 d->selectedFiles->removeSelected( ); 560 d->selectedFiles->removeSelected( );
561 writeCurrentM3u(); 561 writeCurrentM3u();
562} 562}
563 563
564 564
565void PlayListWidget::playIt( QListViewItem *it) { 565void PlayListWidget::playIt( QListViewItem *it) {
566 if(!it) return; 566 if(!it) return;
567 mediaPlayerState->setPlaying(FALSE); 567 mediaPlayerState->setPlaying(FALSE);
568 mediaPlayerState->setPlaying(TRUE); 568 mediaPlayerState->setPlaying(TRUE);
569 d->selectedFiles->unSelect(); 569 d->selectedFiles->unSelect();
570} 570}
571 571
572 572
573void PlayListWidget::addToSelection( QListViewItem *it) { 573void PlayListWidget::addToSelection( QListViewItem *it) {
574 d->setDocumentUsed = FALSE; 574 d->setDocumentUsed = FALSE;
575 575
576 if(it) { 576 if(it) {
577 if ( currentTab() == CurrentPlayList ) 577 if ( currentTab() == CurrentPlayList )
578 return; 578 return;
579 // case 1: { 579 // case 1: {
580 DocLnk lnk; 580 DocLnk lnk;
581 QString filename; 581 QString filename;
582 582
583 filename=it->text(3); 583 filename=it->text(3);
584 lnk.setName( QFileInfo(filename).baseName() ); //sets name 584 lnk.setName( QFileInfo(filename).baseName() ); //sets name
585 lnk.setFile( filename ); //sets file name 585 lnk.setFile( filename ); //sets file name
586 d->selectedFiles->addToSelection( lnk); 586 d->selectedFiles->addToSelection( lnk);
587 587
588 writeCurrentM3u(); 588 writeCurrentM3u();
589 tabWidget->setCurrentPage(0); 589 tabWidget->setCurrentPage(0);
590 590
591 } 591 }
592} 592}
593 593
594 594
595void PlayListWidget::tabChanged(QWidget *) { 595void PlayListWidget::tabChanged(QWidget *) {
596 596
597 switch ( currentTab() ) { 597 switch ( currentTab() ) {
598 case CurrentPlayList: 598 case CurrentPlayList:
599 { 599 {
600 if( !tbDeletePlaylist->isHidden() ) { 600 if( !tbDeletePlaylist->isHidden() ) {
601 tbDeletePlaylist->hide(); 601 tbDeletePlaylist->hide();
602 } 602 }
603 d->tbRemoveFromList->setEnabled(TRUE); 603 d->tbRemoveFromList->setEnabled(TRUE);
604 d->tbAddToList->setEnabled(FALSE); 604 d->tbAddToList->setEnabled(FALSE);
605 } 605 }
606 break; 606 break;
607 case AudioFiles: 607 case AudioFiles:
608 { 608 {
609 // audioView->clear(); 609 // audioView->clear();
610 if(!audioPopulated) populateAudioView(); 610 if(!audioPopulated) populateAudioView();
611 611
612 if( !tbDeletePlaylist->isHidden() ) { 612 if( !tbDeletePlaylist->isHidden() ) {
613 tbDeletePlaylist->hide(); 613 tbDeletePlaylist->hide();
614 } 614 }
615 d->tbRemoveFromList->setEnabled(FALSE); 615 d->tbRemoveFromList->setEnabled(FALSE);
616 d->tbAddToList->setEnabled(TRUE); 616 d->tbAddToList->setEnabled(TRUE);
617 } 617 }
618 break; 618 break;
619 case VideoFiles: 619 case VideoFiles:
620 { 620 {
621 // videoView->clear(); 621 // videoView->clear();
622 if(!videoPopulated) populateVideoView(); 622 if(!videoPopulated) populateVideoView();
623 if( !tbDeletePlaylist->isHidden() ) { 623 if( !tbDeletePlaylist->isHidden() ) {
624 tbDeletePlaylist->hide(); 624 tbDeletePlaylist->hide();
625 } 625 }
626 d->tbRemoveFromList->setEnabled(FALSE); 626 d->tbRemoveFromList->setEnabled(FALSE);
627 d->tbAddToList->setEnabled(TRUE); 627 d->tbAddToList->setEnabled(TRUE);
628 } 628 }
629 break; 629 break;
630 case PlayLists: 630 case PlayLists:
631 { 631 {
632 if( tbDeletePlaylist->isHidden() ) { 632 if( tbDeletePlaylist->isHidden() ) {
633 tbDeletePlaylist->show(); 633 tbDeletePlaylist->show();
634 } 634 }
635 playLists->reread(); 635 playLists->reread();
636 d->tbAddToList->setEnabled(FALSE); 636 d->tbAddToList->setEnabled(FALSE);
637 } 637 }
638 break; 638 break;
639 }; 639 };
640} 640}
641 641
642 642
643void PlayListWidget::btnPlay(bool b) { 643void PlayListWidget::btnPlay(bool b) {
644// mediaPlayerState->setPlaying(false); 644// mediaPlayerState->setPlaying(false);
645 mediaPlayerState->setPlaying(b); 645 mediaPlayerState->setPlaying(b);
646 insanityBool=FALSE; 646 insanityBool=FALSE;
647} 647}
648 648
649void PlayListWidget::deletePlaylist() { 649void PlayListWidget::deletePlaylist() {
650 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 650 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
651 (tr("You really want to delete\nthis playlist?")), 651 (tr("You really want to delete\nthis playlist?")),
652 (tr("Yes")), (tr("No")), 0 )){ 652 (tr("Yes")), (tr("No")), 0 )){
653 case 0: // Yes clicked, 653 case 0: // Yes clicked,
654 QFile().remove(playLists->selectedDocument().file()); 654 QFile().remove(playLists->selectedDocument().file());
655 QFile().remove(playLists->selectedDocument().linkFile()); 655 QFile().remove(playLists->selectedDocument().linkFile());
656 playLists->reread(); 656 playLists->reread();
657 break; 657 break;
658 case 1: // Cancel 658 case 1: // Cancel
659 break; 659 break;
660 }; 660 };
661} 661}
662 662
663 663
664void PlayListWidget::playSelected() { 664void PlayListWidget::playSelected() {
665 btnPlay( TRUE); 665 btnPlay( TRUE);
666} 666}
667 667
668 668
669void PlayListWidget::scanForAudio() { 669void PlayListWidget::scanForAudio() {
670// qDebug("scan for audio"); 670// qDebug("scan for audio");
671 files.detachChildren(); 671 files.detachChildren();
672 QListIterator<DocLnk> sdit( files.children() ); 672 QListIterator<DocLnk> sdit( files.children() );
673 for ( ; sdit.current(); ++sdit ) { 673 for ( ; sdit.current(); ++sdit ) {
674 delete sdit.current(); 674 delete sdit.current();
675 } 675 }
676// Global::findDocuments( &files, "audio/*"); 676// Global::findDocuments( &files, "audio/*");
677 Global::findDocuments( &files, audioMimes); 677 Global::findDocuments( &files, audioMimes);
678 audioScan = true; 678 audioScan = true;
679 populateAudioView(); 679 populateAudioView();
680} 680}
681 681
682void PlayListWidget::scanForVideo() { 682void PlayListWidget::scanForVideo() {
683// qDebug("scan for video"); 683// qDebug("scan for video");
684 vFiles.detachChildren(); 684 vFiles.detachChildren();
685 QListIterator<DocLnk> sdit( vFiles.children() ); 685 QListIterator<DocLnk> sdit( vFiles.children() );
686 for ( ; sdit.current(); ++sdit ) { 686 for ( ; sdit.current(); ++sdit ) {
687 delete sdit.current(); 687 delete sdit.current();
688 } 688 }
689 Global::findDocuments(&vFiles, "video/*"); 689 Global::findDocuments(&vFiles, "video/*");
690 videoScan = true; 690 videoScan = true;
691 populateVideoView(); 691 populateVideoView();
692} 692}
693 693
694void PlayListWidget::populateAudioView() { 694void PlayListWidget::populateAudioView() {
695 audioView->clear(); 695 audioView->clear();
696 StorageInfo storageInfo; 696 StorageInfo storageInfo;
697 // const QList<FileSystem> &fs = storageInfo.fileSystems(); 697 // const QList<FileSystem> &fs = storageInfo.fileSystems();
698 if(!audioScan) { 698 if(!audioScan) {
699 scanForAudio(); 699 scanForAudio();
700 } 700 }
701 701
702 QListIterator<DocLnk> dit( files.children() ); 702 QListIterator<DocLnk> dit( files.children() );
703 // QListIterator<FileSystem> it ( fs ); 703 // QListIterator<FileSystem> it ( fs );
704 audioView->clear(); 704 audioView->clear();
705 705
706 QString storage; 706 QString storage;
707 for ( ; dit.current(); ++dit ) { 707 for ( ; dit.current(); ++dit ) {
708// // for( ; it.current(); ++it ){ 708// // for( ; it.current(); ++it ){
709// const QString name = (*dit)->name(); 709// const QString name = (*dit)->name();
710// const QString path = (*dit)->path(); 710// const QString path = (*dit)->path();
711// if(dit.current()->file().find(path) != -1 ) { 711// if(dit.current()->file().find(path) != -1 ) {
712// storage = name; 712// storage = name;
713// // } 713// // }
714// } 714// }
715 715
716 QListViewItem * newItem; 716 QListViewItem * newItem;
717 if ( QFile( dit.current()->file()).exists() || 717 if ( QFile( dit.current()->file()).exists() ||
718 dit.current()->file().left(4) == "http" ) { 718 dit.current()->file().left(4) == "http" ) {
719 long size; 719 long size;
720 if( dit.current()->file().left(4) == "http" ) 720 if( dit.current()->file().left(4) == "http" )
721 size=0; 721 size=0;
722 else 722 else
723 size = QFile( dit.current()->file() ).size(); 723 size = QFile( dit.current()->file() ).size();
724 724
725 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), 725 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
726 QString::number(size ), "" /*storage*/, 726 QString::number(size ), "" /*storage*/,
727 dit.current()->file() ); 727 dit.current()->file() );
728 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); 728 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
729// qDebug("<<<< "+dit.current()->file()); 729// qDebug("<<<< "+dit.current()->file());
730 } 730 }
731 } 731 }
732 audioPopulated=true; 732 audioPopulated=true;
733} 733}
734 734
735 735
736void PlayListWidget::populateVideoView() { 736void PlayListWidget::populateVideoView() {
737 videoView->clear(); 737 videoView->clear();
738 StorageInfo storageInfo; 738 StorageInfo storageInfo;
739 // const QList<FileSystem> &fs = storageInfo.fileSystems(); 739 // const QList<FileSystem> &fs = storageInfo.fileSystems();
740 740
741 if(!videoScan ) { 741 if(!videoScan ) {
742 scanForVideo(); 742 scanForVideo();
743 } 743 }
744 744
745 QListIterator<DocLnk> Vdit( vFiles.children() ); 745 QListIterator<DocLnk> Vdit( vFiles.children() );
746// QListIterator<FileSystem> it ( fs ); 746// QListIterator<FileSystem> it ( fs );
747 videoView->clear(); 747 videoView->clear();
748 QString storage, pathName; 748 QString storage, pathName;
749 for ( ; Vdit.current(); ++Vdit ) { 749 for ( ; Vdit.current(); ++Vdit ) {
750// // for( ; it.current(); ++it ) { 750// // for( ; it.current(); ++it ) {
751// const QString name = (*Vdit)->name(); 751// const QString name = (*Vdit)->name();
752// const QString path = (*Vdit)->path(); 752// const QString path = (*Vdit)->path();
753// if( Vdit.current()->file().find(path) != -1 ) { 753// if( Vdit.current()->file().find(path) != -1 ) {
754// storage=name; 754// storage=name;
755// pathName=path; 755// pathName=path;
756// // } 756// // }
757// } 757// }
758 758
759 QListViewItem * newItem; 759 QListViewItem * newItem;
760 if ( QFile( Vdit.current()->file() ).exists() ) { 760 if ( QFile( Vdit.current()->file() ).exists() ) {
761 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 761 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
762 QString::number( QFile( Vdit.current()->file() ).size() ), 762 QString::number( QFile( Vdit.current()->file() ).size() ),
763 ""/*storage*/, Vdit.current()->file()); 763 ""/*storage*/, Vdit.current()->file());
764 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); 764 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
765 } 765 }
766 } 766 }
767 videoPopulated=true; 767 videoPopulated=true;
768} 768}
769 769
770QListView *PlayListWidget::currentFileListView() const 770QListView *PlayListWidget::currentFileListView() const
771{ 771{
772 switch ( currentTab() ) { 772 switch ( currentTab() ) {
773 case AudioFiles: return audioView; 773 case AudioFiles: return audioView;
774 case VideoFiles: return videoView; 774 case VideoFiles: return videoView;
775 default: assert( false ); 775 default: assert( false );
776 } 776 }
777 return 0; 777 return 0;
778} 778}
779 779
780bool PlayListWidget::inFileListMode() const 780bool PlayListWidget::inFileListMode() const
781{ 781{
782 TabType tab = currentTab(); 782 TabType tab = currentTab();
783 return tab == AudioFiles || tab == VideoFiles; 783 return tab == AudioFiles || tab == VideoFiles;
784} 784}
785 785
786void PlayListWidget::openFile() { 786void PlayListWidget::openFile() {
787 // http://66.28.164.33:2080 787 // http://66.28.164.33:2080
788 // http://somafm.com/star0242.m3u 788 // http://somafm.com/star0242.m3u
789 QString filename, name; 789 QString filename, name;
790 InputDialog *fileDlg; 790 InputDialog *fileDlg;
791 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 791 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
792 fileDlg->exec(); 792 fileDlg->exec();
793 if( fileDlg->result() == 1 ) { 793 if( fileDlg->result() == 1 ) {
794 filename = fileDlg->text(); 794 filename = fileDlg->text();
795 qDebug( "Selected filename is " + filename ); 795 qDebug( "Selected filename is " + filename );
796 // Om3u *m3uList; 796 // Om3u *m3uList;
797 DocLnk lnk; 797 DocLnk lnk;
798 Config cfg( "OpiePlayer" ); 798 Config cfg( "OpiePlayer" );
799 cfg.setGroup("PlayList"); 799 cfg.setGroup("PlayList");
800 800
801 if(filename.left(4) == "http") { 801 if(filename.left(4) == "http") {
802 QString m3uFile, m3uFilePath; 802 QString m3uFile, m3uFilePath;
803 if(filename.find(":",8,TRUE) != -1) { //found a port 803 if(filename.find(":",8,TRUE) != -1) { //found a port
804 m3uFile = filename.left( filename.find( ":",8,TRUE)); 804 m3uFile = filename.left( filename.find( ":",8,TRUE));
805 m3uFile = m3uFile.right( 7); 805 m3uFile = m3uFile.right( 7);
806 } else if(filename.left(4) == "http"){ 806 } else if(filename.left(4) == "http"){
807 m3uFile=filename; 807 m3uFile=filename;
808 m3uFile = m3uFile.right( m3uFile.length() - 7); 808 m3uFile = m3uFile.right( m3uFile.length() - 7);
809 } else{ 809 } else{
810 m3uFile=filename; 810 m3uFile=filename;
811 } 811 }
812 812
813// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); 813// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile);
814 lnk.setName( filename ); //sets name 814 lnk.setName( filename ); //sets name
815 lnk.setFile( filename ); //sets file name 815 lnk.setFile( filename ); //sets file name
816 816
817// lnk.setIcon("opieplayer2/musicfile"); 817// lnk.setIcon("opieplayer2/musicfile");
818 818
819 d->selectedFiles->addToSelection( lnk ); 819 d->selectedFiles->addToSelection( lnk );
820 writeCurrentM3u(); 820 writeCurrentM3u();
821 d->selectedFiles->setSelectedItem( lnk.name()); 821 d->selectedFiles->setSelectedItem( lnk.name());
822 } 822 }
823 else if( filename.right( 3) == "m3u" ) { 823 else if( filename.right( 3) == "m3u" ) {
824 readm3u( filename ); 824 readm3u( filename );
825 825
826 } else if( filename.right(3) == "pls" ) { 826 } else if( filename.right(3) == "pls" ) {
827 readPls( filename ); 827 readPls( filename );
828 } else { 828 } else {
829 lnk.setName( QFileInfo(filename).baseName() ); //sets name 829 lnk.setName( QFileInfo(filename).baseName() ); //sets name
830 lnk.setFile( filename ); //sets file name 830 lnk.setFile( filename ); //sets file name
831 d->selectedFiles->addToSelection( lnk); 831 d->selectedFiles->addToSelection( lnk);
832 writeCurrentM3u(); 832 writeCurrentM3u();
833 d->selectedFiles->setSelectedItem( lnk.name()); 833 d->selectedFiles->setSelectedItem( lnk.name());
834 } 834 }
835 } 835 }
836 836
837 if( fileDlg ) { 837 if( fileDlg ) {
838 delete fileDlg; 838 delete fileDlg;
839 } 839 }
840} 840}
841 841
842/* 842/*
843reads m3u and shows files/urls to playlist widget */ 843reads m3u and shows files/urls to playlist widget */
844void PlayListWidget::readm3u( const QString &filename ) { 844void PlayListWidget::readm3u( const QString &filename ) {
845 qDebug( "read m3u filename " + filename ); 845 qDebug( "read m3u filename " + filename );
846 846
847 Om3u *m3uList; 847 Om3u *m3uList;
848 QString s, name; 848 QString s, name;
849 m3uList = new Om3u( filename, IO_ReadOnly ); 849 m3uList = new Om3u( filename, IO_ReadOnly );
850 m3uList->readM3u(); 850 m3uList->readM3u();
851 DocLnk lnk; 851 DocLnk lnk;
852 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 852 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
853 s = *it; 853 s = *it;
854// qDebug("reading "+ s); 854// qDebug("reading "+ s);
855 if(s.left(4)=="http") { 855 if(s.left(4)=="http") {
856 lnk.setName( s ); //sets file name 856 lnk.setName( s ); //sets file name
857 lnk.setIcon("opieplayer2/musicfile"); 857 lnk.setIcon("opieplayer2/musicfile");
858 lnk.setFile( s ); //sets file name 858 lnk.setFile( s ); //sets file name
859 859
860 } else { 860 } else {
861 // if( QFileInfo( s ).exists() ) { 861 // if( QFileInfo( s ).exists() ) {
862 lnk.setName( QFileInfo(s).baseName()); 862 lnk.setName( QFileInfo(s).baseName());
863 // if(s.right(4) == '.') {//if regular file 863 // if(s.right(4) == '.') {//if regular file
864 if(s.left(1) != "/") { 864 if(s.left(1) != "/") {
865 // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); 865 // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s);
866 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); 866 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s);
867// lnk.setIcon(MimeType(s).pixmap() ); 867// lnk.setIcon(MimeType(s).pixmap() );
868// lnk.setIcon("SoundPlayer"); 868// lnk.setIcon("SoundPlayer");
869 } else { 869 } else {
870 // qDebug("set link2 "+s); 870 // qDebug("set link2 "+s);
871 lnk.setFile( s); 871 lnk.setFile( s);
872// lnk.setIcon(MimeType(s).pixmap() ); 872// lnk.setIcon(MimeType(s).pixmap() );
873// lnk.setIcon("SoundPlayer"); 873// lnk.setIcon("SoundPlayer");
874 } 874 }
875 } 875 }
876 d->selectedFiles->addToSelection( lnk ); 876 d->selectedFiles->addToSelection( lnk );
877 } 877 }
878 Config config( "OpiePlayer" ); 878 Config config( "OpiePlayer" );
879 config.setGroup( "PlayList" ); 879 config.setGroup( "PlayList" );
880 880
881 config.writeEntry("CurrentPlaylist",filename); 881 config.writeEntry("CurrentPlaylist",filename);
882 config.write(); 882 config.write();
883 currentPlayList=filename; 883 currentPlayList=filename;
884 884
885// m3uList->write(); 885// m3uList->write();
886 m3uList->close(); 886 m3uList->close();
887 if(m3uList) delete m3uList; 887 if(m3uList) delete m3uList;
888 888
889 d->selectedFiles->setSelectedItem( s); 889 d->selectedFiles->setSelectedItem( s);
890 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); 890 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName());
891 891
892} 892}
893 893
894/* 894/*
895reads pls and adds files/urls to playlist */ 895reads pls and adds files/urls to playlist */
896void PlayListWidget::readPls( const QString &filename ) { 896void PlayListWidget::readPls( const QString &filename ) {
897 897
898 qDebug( "pls filename is " + filename ); 898 qDebug( "pls filename is " + filename );
899 Om3u *m3uList; 899 Om3u *m3uList;
900 QString s, name; 900 QString s, name;
901 m3uList = new Om3u( filename, IO_ReadOnly ); 901 m3uList = new Om3u( filename, IO_ReadOnly );
902 m3uList->readPls(); 902 m3uList->readPls();
903 903
904 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 904 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
905 s = *it; 905 s = *it;
906 // s.replace( QRegExp( "%20" )," " ); 906 // s.replace( QRegExp( "%20" )," " );
907 DocLnk lnk( s ); 907 DocLnk lnk( s );
908 QFileInfo f( s ); 908 QFileInfo f( s );
909 QString name = f.baseName(); 909 QString name = f.baseName();
910 910
911 if( name.left( 4 ) == "http" ) { 911 if( name.left( 4 ) == "http" ) {
912 name = s.right( s.length() - 7); 912 name = s.right( s.length() - 7);
913 } else { 913 } else {
914 name = s; 914 name = s;
915 } 915 }
916 916
917 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); 917 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
918 918
919 lnk.setName( name ); 919 lnk.setName( name );
920 if( s.at( s.length() - 4) == '.') {// if this is probably a file 920 if( s.at( s.length() - 4) == '.') {// if this is probably a file
921 lnk.setFile( s ); 921 lnk.setFile( s );
922 } else { //if its a url 922 } else { //if its a url
923// if( name.right( 1 ).find( '/' ) == -1) { 923// if( name.right( 1 ).find( '/' ) == -1) {
924// s += "/"; 924// s += "/";
925// } 925// }
926 lnk.setFile( s ); 926 lnk.setFile( s );
927 } 927 }
928 lnk.setType( "audio/x-mpegurl" ); 928 lnk.setType( "audio/x-mpegurl" );
929 929
930 lnk.writeLink(); 930 lnk.writeLink();
931 d->selectedFiles->addToSelection( lnk ); 931 d->selectedFiles->addToSelection( lnk );
932 } 932 }
933 933
934 m3uList->close(); 934 m3uList->close();
935 if(m3uList) delete m3uList; 935 if(m3uList) delete m3uList;
936} 936}
937 937
938/* 938/*
939 writes current playlist to current m3u file */ 939 writes current playlist to current m3u file */
940void PlayListWidget::writeCurrentM3u() { 940void PlayListWidget::writeCurrentM3u() {
941 qDebug("writing to current m3u"); 941 qDebug("writing to current m3u");
942 Config cfg( "OpiePlayer" ); 942 Config cfg( "OpiePlayer" );
943 cfg.setGroup("PlayList"); 943 cfg.setGroup("PlayList");
944 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 944 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
945 945
946 Om3u *m3uList; 946 Om3u *m3uList;
947 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); 947 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate );
948 if( d->selectedFiles->first()) { 948 if( d->selectedFiles->first()) {
949 949
950 do { 950 do {
951 // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); 951 // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file());
952 m3uList->add( d->selectedFiles->current()->file() ); 952 m3uList->add( d->selectedFiles->current()->file() );
953 } 953 }
954 while ( d->selectedFiles->next() ); 954 while ( d->selectedFiles->next() );
955 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); 955 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" );
956 m3uList->write(); 956 m3uList->write();
957 m3uList->close(); 957 m3uList->close();
958 958
959 if(m3uList) delete m3uList; 959 if(m3uList) delete m3uList;
960 } 960 }
961 961
962} 962}
963 963
964 /* 964 /*
965 writes current playlist to m3u file */ 965 writes current playlist to m3u file */
966void PlayListWidget::writem3u() { 966void PlayListWidget::writem3u() {
967 InputDialog *fileDlg; 967 InputDialog *fileDlg;
968 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); 968 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
969 fileDlg->exec(); 969 fileDlg->exec();
970 QString name, filename, list; 970 QString name, filename, list;
971 Om3u *m3uList; 971 Om3u *m3uList;
972 972
973 if( fileDlg->result() == 1 ) { 973 if( fileDlg->result() == 1 ) {
974 name = fileDlg->text(); 974 name = fileDlg->text();
975// qDebug( filename ); 975// qDebug( filename );
976 976
977 if( name.left( 1) != "/" ) { 977 if( name.left( 1) != "/" ) {
978 filename = QPEApplication::documentDir() + "/" + name; 978 filename = QPEApplication::documentDir() + "/" + name;
979 } 979 }
980 980
981 if( name.right( 3 ) != "m3u" ) { 981 if( name.right( 3 ) != "m3u" ) {
982 filename = QPEApplication::documentDir() + "/" +name+".m3u"; 982 filename = QPEApplication::documentDir() + "/" +name+".m3u";
983 } 983 }
984 984
985 if( d->selectedFiles->first()) { 985 if( d->selectedFiles->first()) {
986 m3uList = new Om3u(filename, IO_ReadWrite); 986 m3uList = new Om3u(filename, IO_ReadWrite);
987 987
988 do { 988 do {
989 m3uList->add( d->selectedFiles->current()->file()); 989 m3uList->add( d->selectedFiles->current()->file());
990 } 990 }
991 while ( d->selectedFiles->next() ); 991 while ( d->selectedFiles->next() );
992 // qDebug( list ); 992 // qDebug( list );
993 m3uList->write(); 993 m3uList->write();
994 m3uList->close(); 994 m3uList->close();
995 if(m3uList) delete m3uList; 995 if(m3uList) delete m3uList;
996 996
997 if(fileDlg) delete fileDlg; 997 if(fileDlg) delete fileDlg;
998 998
999 DocLnk lnk; 999 DocLnk lnk;
1000 lnk.setFile( filename); 1000 lnk.setFile( filename);
1001 lnk.setIcon("opieplayer2/playlist2"); 1001 lnk.setIcon("opieplayer2/playlist2");
1002 lnk.setName( name); //sets file name 1002 lnk.setName( name); //sets file name
1003 1003
1004 // qDebug(filename); 1004 // qDebug(filename);
1005 Config config( "OpiePlayer" ); 1005 Config config( "OpiePlayer" );
1006 config.setGroup( "PlayList" ); 1006 config.setGroup( "PlayList" );
1007 1007
1008 config.writeEntry("CurrentPlaylist",filename); 1008 config.writeEntry("CurrentPlaylist",filename);
1009 currentPlayList=filename; 1009 currentPlayList=filename;
1010 1010
1011 if(!lnk.writeLink()) { 1011 if(!lnk.writeLink()) {
1012 qDebug("Writing doclink did not work"); 1012 qDebug("Writing doclink did not work");
1013 } 1013 }
1014 1014
1015 setCaption(tr("OpiePlayer: ") + name); 1015 setCaption(tr("OpiePlayer: ") + name);
1016 } 1016 }
1017 } 1017 }
1018} 1018}
1019 1019
1020void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { 1020void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
1021 switch ( e->key() ) { 1021 switch ( e->key() ) {
1022 ////////////////////////////// Zaurus keys 1022 ////////////////////////////// Zaurus keys
1023 case Key_F9: //activity 1023 case Key_F9: //activity
1024 // if(audioUI->isHidden()) 1024 // if(audioUI->isHidden())
1025 // audioUI->showMaximized(); 1025 // audioUI->showMaximized();
1026 break; 1026 break;
1027 case Key_F10: //contacts 1027 case Key_F10: //contacts
1028 // if( videoUI->isHidden()) 1028 // if( videoUI->isHidden())
1029 // videoUI->showMaximized(); 1029 // videoUI->showMaximized();
1030 break; 1030 break;
1031 case Key_F11: //menu 1031 case Key_F11: //menu
1032 break; 1032 break;
1033 case Key_F12: //home 1033 case Key_F12: //home
1034 // doBlank(); 1034 // doBlank();
1035 break; 1035 break;
1036 case Key_F13: //mail 1036 case Key_F13: //mail
1037 // doUnblank(); 1037 // doUnblank();
1038 break; 1038 break;
1039 case Key_Q: //add to playlist 1039 case Key_Q: //add to playlist
1040 addSelected(); 1040 addSelected();
1041 break; 1041 break;
1042 case Key_R: //remove from playlist 1042 case Key_R: //remove from playlist
1043 removeSelected(); 1043 removeSelected();
1044 break; 1044 break;
1045 // case Key_P: //play 1045 // case Key_P: //play
1046 // qDebug("Play"); 1046 // qDebug("Play");
1047 // playSelected(); 1047 // playSelected();
1048 // break; 1048 // break;
1049 case Key_Space: 1049 case Key_Space:
1050 // playSelected(); puh 1050 // playSelected(); puh
1051 break; 1051 break;
1052 case Key_1: 1052 case Key_1:
1053 tabWidget->setCurrentPage( 0 ); 1053 tabWidget->setCurrentPage( 0 );
1054 break; 1054 break;
1055 case Key_2: 1055 case Key_2:
1056 tabWidget->setCurrentPage( 1 ); 1056 tabWidget->setCurrentPage( 1 );
1057 break; 1057 break;
1058 case Key_3: 1058 case Key_3:
1059 tabWidget->setCurrentPage( 2 ); 1059 tabWidget->setCurrentPage( 2 );
1060 break; 1060 break;
1061 case Key_4: 1061 case Key_4:
1062 tabWidget->setCurrentPage( 3 ); 1062 tabWidget->setCurrentPage( 3 );
1063 break; 1063 break;
1064 case Key_Down: 1064 case Key_Down:
1065 if ( !d->selectedFiles->next() ) 1065 if ( !d->selectedFiles->next() )
1066 d->selectedFiles->first(); 1066 d->selectedFiles->first();
1067 break; 1067 break;
1068 case Key_Up: 1068 case Key_Up:
1069 if ( !d->selectedFiles->prev() ) 1069 if ( !d->selectedFiles->prev() )
1070 // d->selectedFiles->last(); 1070 // d->selectedFiles->last();
1071 break; 1071 break;
1072 } 1072 }
1073} 1073}
1074 1074
1075void PlayListWidget::pmViewActivated(int index) { 1075void PlayListWidget::pmViewActivated(int index) {
1076// qDebug("%d", index); 1076// qDebug("%d", index);
1077 switch(index) { 1077 switch(index) {
1078 case -16: 1078 case -16:
1079 { 1079 {
1080 mediaPlayerState->toggleFullscreen(); 1080 mediaPlayerState->toggleFullscreen();
1081 bool b=mediaPlayerState->isFullscreen(); 1081 bool b=mediaPlayerState->isFullscreen();
1082 pmView->setItemChecked( index, b); 1082 pmView->setItemChecked( index, b);
1083 Config cfg( "OpiePlayer" ); 1083 Config cfg( "OpiePlayer" );
1084 cfg.writeEntry( "FullScreen", b ); 1084 cfg.writeEntry( "FullScreen", b );
1085 } 1085 }
1086 break; 1086 break;
1087 }; 1087 };
1088} 1088}
1089 1089
1090void PlayListWidget::populateSkinsMenu() { 1090void PlayListWidget::populateSkinsMenu() {
1091 int item = 0; 1091 int item = 0;
1092 defaultSkinIndex = 0; 1092 defaultSkinIndex = 0;
1093 QString skinName; 1093 QString skinName;
1094 Config cfg( "OpiePlayer" ); 1094 Config cfg( "OpiePlayer" );
1095 cfg.setGroup("Options" ); 1095 cfg.setGroup("Options" );
1096 QString skin = cfg.readEntry( "Skin", "default" ); 1096 QString skin = cfg.readEntry( "Skin", "default" );
1097 1097
1098 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); 1098 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
1099 skinsDir.setFilter( QDir::Dirs ); 1099 skinsDir.setFilter( QDir::Dirs );
1100 skinsDir.setSorting(QDir::Name ); 1100 skinsDir.setSorting(QDir::Name );
1101 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 1101 const QFileInfoList *skinslist = skinsDir.entryInfoList();
1102 QFileInfoListIterator it( *skinslist ); 1102 QFileInfoListIterator it( *skinslist );
1103 QFileInfo *fi; 1103 QFileInfo *fi;
1104 while ( ( fi = it.current() ) ) { 1104 while ( ( fi = it.current() ) ) {
1105 skinName = fi->fileName(); 1105 skinName = fi->fileName();
1106// qDebug( fi->fileName() ); 1106// qDebug( fi->fileName() );
1107 if( skinName != "." && skinName != ".." && skinName !="CVS" ) { 1107 if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
1108 item = skinsMenu->insertItem( fi->fileName() ) ; 1108 item = skinsMenu->insertItem( fi->fileName() ) ;
1109 } 1109 }
1110 if( skinName == "default" ) { 1110 if( skinName == "default" ) {
1111 defaultSkinIndex = item; 1111 defaultSkinIndex = item;
1112 } 1112 }
1113 if( skinName == skin ) { 1113 if( skinName == skin ) {
1114 skinsMenu->setItemChecked( item, TRUE ); 1114 skinsMenu->setItemChecked( item, TRUE );
1115 } 1115 }
1116 ++it; 1116 ++it;
1117 } 1117 }
1118} 1118}
1119 1119
1120void PlayListWidget::skinsMenuActivated( int item ) { 1120void PlayListWidget::skinsMenuActivated( int item ) {
1121 for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { 1121 for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) {
1122 skinsMenu->setItemChecked( i, FALSE ); 1122 skinsMenu->setItemChecked( i, FALSE );
1123 } 1123 }
1124 skinsMenu->setItemChecked( item, TRUE ); 1124 skinsMenu->setItemChecked( item, TRUE );
1125 1125
1126 Config cfg( "OpiePlayer" ); 1126 Config cfg( "OpiePlayer" );
1127 cfg.setGroup("Options"); 1127 cfg.setGroup("Options");
1128 cfg.writeEntry("Skin", skinsMenu->text( item ) ); 1128 cfg.writeEntry("Skin", skinsMenu->text( item ) );
1129 QMessageBox::warning( this, tr( "OpiePlayer" ), 1129 QMessageBox::warning( this, tr( "OpiePlayer" ),
1130 tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); 1130 tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) );
1131} 1131}
1132 1132
1133PlayListWidget::TabType PlayListWidget::currentTab() const 1133PlayListWidget::TabType PlayListWidget::currentTab() const
1134{ 1134{
1135 static const TabType indexToTabType[ TabTypeCount ] = 1135 static const TabType indexToTabType[ TabTypeCount ] =
1136 { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; 1136 { CurrentPlayList, AudioFiles, VideoFiles, PlayLists };
1137 1137
1138 int index = tabWidget->currentPageIndex(); 1138 int index = tabWidget->currentPageIndex();
1139 assert( index < TabTypeCount && index >= 0 ); 1139 assert( index < TabTypeCount && index >= 0 );
1140 1140
1141 return indexToTabType[ index ]; 1141 return indexToTabType[ index ];
1142} 1142}
1143 1143
1144PlayListWidget::Entry PlayListWidget::currentEntry() const
1145{
1146 if ( currentTab() == CurrentPlayList ) {
1147 const DocLnk *lnk = current();
1148 return Entry( lnk->name(), lnk->file() );
1149 }
1150
1151 return Entry( currentFileListPathName() );
1152}
1153
1144QString PlayListWidget::currentFileListPathName() const { 1154QString PlayListWidget::currentFileListPathName() const {
1145 return currentFileListView()->currentItem()->text( 3 ); 1155 return currentFileListView()->currentItem()->text( 3 );
1146} 1156}
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index 2e2ff89..511a192 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -1,128 +1,141 @@
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
62 {
63 Entry( const QString &_name, const QString &_fileName )
64 : name( _name ), file( _fileName ) {}
65 Entry( const QString &_fileName )
66 : name( _fileName ), file( _fileName ) {}
67
68 QString name;
69 QString file;
70 };
71
61 PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); 72 PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 );
62 ~PlayListWidget(); 73 ~PlayListWidget();
63 DocLnkSet files; 74 DocLnkSet files;
64 DocLnkSet vFiles; 75 DocLnkSet vFiles;
65 bool fromSetDocument; 76 bool fromSetDocument;
66 bool insanityBool; 77 bool insanityBool;
67 QString setDocFileRef, currentPlayList; 78 QString setDocFileRef, currentPlayList;
68 // retrieve the current playlist entry (media file link) 79 // retrieve the current playlist entry (media file link)
69 const DocLnk *current(); 80 const DocLnk *current() const;
70 void useSelectedDocument(); 81 void useSelectedDocument();
71 int selected; 82 int selected;
72 TabType currentTab() const; 83 TabType currentTab() const;
73 84
85 Entry currentEntry() const;
86
74public slots: 87public slots:
75 bool first(); 88 bool first();
76 bool last(); 89 bool last();
77 bool next(); 90 bool next();
78 bool prev(); 91 bool prev();
79 void writeDefaultPlaylist( ); 92 void writeDefaultPlaylist( );
80 QString currentFileListPathName() const; 93 QString currentFileListPathName() const;
81protected: 94protected:
82 void keyReleaseEvent( QKeyEvent *e); 95 void keyReleaseEvent( QKeyEvent *e);
83 96
84private: 97private:
85 int defaultSkinIndex; 98 int defaultSkinIndex;
86 bool audioScan, videoScan, audioPopulated, videoPopulated; 99 bool audioScan, videoScan, audioPopulated, videoPopulated;
87 void readm3u(const QString &); 100 void readm3u(const QString &);
88 void readPls(const QString &); 101 void readPls(const QString &);
89 void initializeStates(); 102 void initializeStates();
90 void populateAudioView(); 103 void populateAudioView();
91 void populateVideoView(); 104 void populateVideoView();
92 105
93 QListView *currentFileListView() const; 106 QListView *currentFileListView() const;
94 107
95 bool inFileListMode() const; 108 bool inFileListMode() const;
96 109
97private slots: 110private slots:
98 void populateSkinsMenu(); 111 void populateSkinsMenu();
99 void skinsMenuActivated(int); 112 void skinsMenuActivated(int);
100 void pmViewActivated(int); 113 void pmViewActivated(int);
101 void writem3u(); 114 void writem3u();
102 void writeCurrentM3u(); 115 void writeCurrentM3u();
103 void scanForAudio(); 116 void scanForAudio();
104 void scanForVideo(); 117 void scanForVideo();
105 void openFile(); 118 void openFile();
106 void setDocument( const QString& fileref ); 119 void setDocument( const QString& fileref );
107 void addToSelection( const DocLnk& ); // Add a media file to the playlist 120 void addToSelection( const DocLnk& ); // Add a media file to the playlist
108 void addToSelection( QListViewItem* ); // Add a media file to the playlist 121 void addToSelection( QListViewItem* ); // Add a media file to the playlist
109 void setPlaylist( bool ); // Show/Hide the playlist 122 void setPlaylist( bool ); // Show/Hide the playlist
110 void clearList(); 123 void clearList();
111 void addAllToList(); 124 void addAllToList();
112 void addAllMusicToList(); 125 void addAllMusicToList();
113 void addAllVideoToList(); 126 void addAllVideoToList();
114 void saveList(); // Save the playlist 127 void saveList(); // Save the playlist
115 void loadList( const DocLnk &); // Load a playlist 128 void loadList( const DocLnk &); // Load a playlist
116 void playIt( QListViewItem *); 129 void playIt( QListViewItem *);
117 void btnPlay(bool); 130 void btnPlay(bool);
118 void deletePlaylist(); 131 void deletePlaylist();
119 void addSelected(); 132 void addSelected();
120 void removeSelected(); 133 void removeSelected();
121 void tabChanged(QWidget*); 134 void tabChanged(QWidget*);
122 void viewPressed( int, QListViewItem *, const QPoint&, int); 135 void viewPressed( int, QListViewItem *, const QPoint&, int);
123 void playlistViewPressed( int, QListViewItem *, const QPoint&, int); 136 void playlistViewPressed( int, QListViewItem *, const QPoint&, int);
124 void playSelected(); 137 void playSelected();
125}; 138};
126 139
127#endif // PLAY_LIST_WIDGET_H 140#endif // PLAY_LIST_WIDGET_H
128 141