summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index ce73252..b04fe8d 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -85,1064 +85,1068 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
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() const { // 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 d->tbPlay->setEnabled( true );
598
597 switch ( currentTab() ) { 599 switch ( currentTab() ) {
598 case CurrentPlayList: 600 case CurrentPlayList:
599 { 601 {
600 if( !tbDeletePlaylist->isHidden() ) { 602 if( !tbDeletePlaylist->isHidden() ) {
601 tbDeletePlaylist->hide(); 603 tbDeletePlaylist->hide();
602 } 604 }
603 d->tbRemoveFromList->setEnabled(TRUE); 605 d->tbRemoveFromList->setEnabled(TRUE);
604 d->tbAddToList->setEnabled(FALSE); 606 d->tbAddToList->setEnabled(FALSE);
605 } 607 }
606 break; 608 break;
607 case AudioFiles: 609 case AudioFiles:
608 { 610 {
609 // audioView->clear(); 611 // audioView->clear();
610 if(!audioPopulated) populateAudioView(); 612 if(!audioPopulated) populateAudioView();
611 613
612 if( !tbDeletePlaylist->isHidden() ) { 614 if( !tbDeletePlaylist->isHidden() ) {
613 tbDeletePlaylist->hide(); 615 tbDeletePlaylist->hide();
614 } 616 }
615 d->tbRemoveFromList->setEnabled(FALSE); 617 d->tbRemoveFromList->setEnabled(FALSE);
616 d->tbAddToList->setEnabled(TRUE); 618 d->tbAddToList->setEnabled(TRUE);
617 } 619 }
618 break; 620 break;
619 case VideoFiles: 621 case VideoFiles:
620 { 622 {
621 // videoView->clear(); 623 // videoView->clear();
622 if(!videoPopulated) populateVideoView(); 624 if(!videoPopulated) populateVideoView();
623 if( !tbDeletePlaylist->isHidden() ) { 625 if( !tbDeletePlaylist->isHidden() ) {
624 tbDeletePlaylist->hide(); 626 tbDeletePlaylist->hide();
625 } 627 }
626 d->tbRemoveFromList->setEnabled(FALSE); 628 d->tbRemoveFromList->setEnabled(FALSE);
627 d->tbAddToList->setEnabled(TRUE); 629 d->tbAddToList->setEnabled(TRUE);
628 } 630 }
629 break; 631 break;
630 case PlayLists: 632 case PlayLists:
631 { 633 {
632 if( tbDeletePlaylist->isHidden() ) { 634 if( tbDeletePlaylist->isHidden() ) {
633 tbDeletePlaylist->show(); 635 tbDeletePlaylist->show();
634 } 636 }
635 playLists->reread(); 637 playLists->reread();
636 d->tbAddToList->setEnabled(FALSE); 638 d->tbAddToList->setEnabled(FALSE);
639
640 d->tbPlay->setEnabled( false );
637 } 641 }
638 break; 642 break;
639 }; 643 };
640} 644}
641 645
642 646
643void PlayListWidget::btnPlay(bool b) { 647void PlayListWidget::btnPlay(bool b) {
644// mediaPlayerState->setPlaying(false); 648// mediaPlayerState->setPlaying(false);
645 mediaPlayerState->setPlaying(b); 649 mediaPlayerState->setPlaying(b);
646 insanityBool=FALSE; 650 insanityBool=FALSE;
647} 651}
648 652
649void PlayListWidget::deletePlaylist() { 653void PlayListWidget::deletePlaylist() {
650 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 654 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
651 (tr("You really want to delete\nthis playlist?")), 655 (tr("You really want to delete\nthis playlist?")),
652 (tr("Yes")), (tr("No")), 0 )){ 656 (tr("Yes")), (tr("No")), 0 )){
653 case 0: // Yes clicked, 657 case 0: // Yes clicked,
654 QFile().remove(playLists->selectedDocument().file()); 658 QFile().remove(playLists->selectedDocument().file());
655 QFile().remove(playLists->selectedDocument().linkFile()); 659 QFile().remove(playLists->selectedDocument().linkFile());
656 playLists->reread(); 660 playLists->reread();
657 break; 661 break;
658 case 1: // Cancel 662 case 1: // Cancel
659 break; 663 break;
660 }; 664 };
661} 665}
662 666
663 667
664void PlayListWidget::playSelected() { 668void PlayListWidget::playSelected() {
665 btnPlay( TRUE); 669 btnPlay( TRUE);
666} 670}
667 671
668 672
669void PlayListWidget::scanForAudio() { 673void PlayListWidget::scanForAudio() {
670// qDebug("scan for audio"); 674// qDebug("scan for audio");
671 files.detachChildren(); 675 files.detachChildren();
672 QListIterator<DocLnk> sdit( files.children() ); 676 QListIterator<DocLnk> sdit( files.children() );
673 for ( ; sdit.current(); ++sdit ) { 677 for ( ; sdit.current(); ++sdit ) {
674 delete sdit.current(); 678 delete sdit.current();
675 } 679 }
676// Global::findDocuments( &files, "audio/*"); 680// Global::findDocuments( &files, "audio/*");
677 Global::findDocuments( &files, audioMimes); 681 Global::findDocuments( &files, audioMimes);
678 audioScan = true; 682 audioScan = true;
679 populateAudioView(); 683 populateAudioView();
680} 684}
681 685
682void PlayListWidget::scanForVideo() { 686void PlayListWidget::scanForVideo() {
683// qDebug("scan for video"); 687// qDebug("scan for video");
684 vFiles.detachChildren(); 688 vFiles.detachChildren();
685 QListIterator<DocLnk> sdit( vFiles.children() ); 689 QListIterator<DocLnk> sdit( vFiles.children() );
686 for ( ; sdit.current(); ++sdit ) { 690 for ( ; sdit.current(); ++sdit ) {
687 delete sdit.current(); 691 delete sdit.current();
688 } 692 }
689 Global::findDocuments(&vFiles, "video/*"); 693 Global::findDocuments(&vFiles, "video/*");
690 videoScan = true; 694 videoScan = true;
691 populateVideoView(); 695 populateVideoView();
692} 696}
693 697
694void PlayListWidget::populateAudioView() { 698void PlayListWidget::populateAudioView() {
695 audioView->clear(); 699 audioView->clear();
696 StorageInfo storageInfo; 700 StorageInfo storageInfo;
697 // const QList<FileSystem> &fs = storageInfo.fileSystems(); 701 // const QList<FileSystem> &fs = storageInfo.fileSystems();
698 if(!audioScan) { 702 if(!audioScan) {
699 scanForAudio(); 703 scanForAudio();
700 } 704 }
701 705
702 QListIterator<DocLnk> dit( files.children() ); 706 QListIterator<DocLnk> dit( files.children() );
703 // QListIterator<FileSystem> it ( fs ); 707 // QListIterator<FileSystem> it ( fs );
704 audioView->clear(); 708 audioView->clear();
705 709
706 QString storage; 710 QString storage;
707 for ( ; dit.current(); ++dit ) { 711 for ( ; dit.current(); ++dit ) {
708// // for( ; it.current(); ++it ){ 712// // for( ; it.current(); ++it ){
709// const QString name = (*dit)->name(); 713// const QString name = (*dit)->name();
710// const QString path = (*dit)->path(); 714// const QString path = (*dit)->path();
711// if(dit.current()->file().find(path) != -1 ) { 715// if(dit.current()->file().find(path) != -1 ) {
712// storage = name; 716// storage = name;
713// // } 717// // }
714// } 718// }
715 719
716 QListViewItem * newItem; 720 QListViewItem * newItem;
717 if ( QFile( dit.current()->file()).exists() || 721 if ( QFile( dit.current()->file()).exists() ||
718 dit.current()->file().left(4) == "http" ) { 722 dit.current()->file().left(4) == "http" ) {
719 long size; 723 long size;
720 if( dit.current()->file().left(4) == "http" ) 724 if( dit.current()->file().left(4) == "http" )
721 size=0; 725 size=0;
722 else 726 else
723 size = QFile( dit.current()->file() ).size(); 727 size = QFile( dit.current()->file() ).size();
724 728
725 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), 729 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
726 QString::number(size ), "" /*storage*/, 730 QString::number(size ), "" /*storage*/,
727 dit.current()->file() ); 731 dit.current()->file() );
728 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); 732 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
729// qDebug("<<<< "+dit.current()->file()); 733// qDebug("<<<< "+dit.current()->file());
730 } 734 }
731 } 735 }
732 audioPopulated=true; 736 audioPopulated=true;
733} 737}
734 738
735 739
736void PlayListWidget::populateVideoView() { 740void PlayListWidget::populateVideoView() {
737 videoView->clear(); 741 videoView->clear();
738 StorageInfo storageInfo; 742 StorageInfo storageInfo;
739 // const QList<FileSystem> &fs = storageInfo.fileSystems(); 743 // const QList<FileSystem> &fs = storageInfo.fileSystems();
740 744
741 if(!videoScan ) { 745 if(!videoScan ) {
742 scanForVideo(); 746 scanForVideo();
743 } 747 }
744 748
745 QListIterator<DocLnk> Vdit( vFiles.children() ); 749 QListIterator<DocLnk> Vdit( vFiles.children() );
746// QListIterator<FileSystem> it ( fs ); 750// QListIterator<FileSystem> it ( fs );
747 videoView->clear(); 751 videoView->clear();
748 QString storage, pathName; 752 QString storage, pathName;
749 for ( ; Vdit.current(); ++Vdit ) { 753 for ( ; Vdit.current(); ++Vdit ) {
750// // for( ; it.current(); ++it ) { 754// // for( ; it.current(); ++it ) {
751// const QString name = (*Vdit)->name(); 755// const QString name = (*Vdit)->name();
752// const QString path = (*Vdit)->path(); 756// const QString path = (*Vdit)->path();
753// if( Vdit.current()->file().find(path) != -1 ) { 757// if( Vdit.current()->file().find(path) != -1 ) {
754// storage=name; 758// storage=name;
755// pathName=path; 759// pathName=path;
756// // } 760// // }
757// } 761// }
758 762
759 QListViewItem * newItem; 763 QListViewItem * newItem;
760 if ( QFile( Vdit.current()->file() ).exists() ) { 764 if ( QFile( Vdit.current()->file() ).exists() ) {
761 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 765 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
762 QString::number( QFile( Vdit.current()->file() ).size() ), 766 QString::number( QFile( Vdit.current()->file() ).size() ),
763 ""/*storage*/, Vdit.current()->file()); 767 ""/*storage*/, Vdit.current()->file());
764 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); 768 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
765 } 769 }
766 } 770 }
767 videoPopulated=true; 771 videoPopulated=true;
768} 772}
769 773
770QListView *PlayListWidget::currentFileListView() const 774QListView *PlayListWidget::currentFileListView() const
771{ 775{
772 switch ( currentTab() ) { 776 switch ( currentTab() ) {
773 case AudioFiles: return audioView; 777 case AudioFiles: return audioView;
774 case VideoFiles: return videoView; 778 case VideoFiles: return videoView;
775 default: assert( false ); 779 default: assert( false );
776 } 780 }
777 return 0; 781 return 0;
778} 782}
779 783
780bool PlayListWidget::inFileListMode() const 784bool PlayListWidget::inFileListMode() const
781{ 785{
782 TabType tab = currentTab(); 786 TabType tab = currentTab();
783 return tab == AudioFiles || tab == VideoFiles; 787 return tab == AudioFiles || tab == VideoFiles;
784} 788}
785 789
786void PlayListWidget::openFile() { 790void PlayListWidget::openFile() {
787 // http://66.28.164.33:2080 791 // http://66.28.164.33:2080
788 // http://somafm.com/star0242.m3u 792 // http://somafm.com/star0242.m3u
789 QString filename, name; 793 QString filename, name;
790 InputDialog *fileDlg; 794 InputDialog *fileDlg;
791 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 795 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
792 fileDlg->exec(); 796 fileDlg->exec();
793 if( fileDlg->result() == 1 ) { 797 if( fileDlg->result() == 1 ) {
794 filename = fileDlg->text(); 798 filename = fileDlg->text();
795 qDebug( "Selected filename is " + filename ); 799 qDebug( "Selected filename is " + filename );
796 // Om3u *m3uList; 800 // Om3u *m3uList;
797 DocLnk lnk; 801 DocLnk lnk;
798 Config cfg( "OpiePlayer" ); 802 Config cfg( "OpiePlayer" );
799 cfg.setGroup("PlayList"); 803 cfg.setGroup("PlayList");
800 804
801 if(filename.left(4) == "http") { 805 if(filename.left(4) == "http") {
802 QString m3uFile, m3uFilePath; 806 QString m3uFile, m3uFilePath;
803 if(filename.find(":",8,TRUE) != -1) { //found a port 807 if(filename.find(":",8,TRUE) != -1) { //found a port
804 m3uFile = filename.left( filename.find( ":",8,TRUE)); 808 m3uFile = filename.left( filename.find( ":",8,TRUE));
805 m3uFile = m3uFile.right( 7); 809 m3uFile = m3uFile.right( 7);
806 } else if(filename.left(4) == "http"){ 810 } else if(filename.left(4) == "http"){
807 m3uFile=filename; 811 m3uFile=filename;
808 m3uFile = m3uFile.right( m3uFile.length() - 7); 812 m3uFile = m3uFile.right( m3uFile.length() - 7);
809 } else{ 813 } else{
810 m3uFile=filename; 814 m3uFile=filename;
811 } 815 }
812 816
813// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); 817// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile);
814 lnk.setName( filename ); //sets name 818 lnk.setName( filename ); //sets name
815 lnk.setFile( filename ); //sets file name 819 lnk.setFile( filename ); //sets file name
816 820
817// lnk.setIcon("opieplayer2/musicfile"); 821// lnk.setIcon("opieplayer2/musicfile");
818 822
819 d->selectedFiles->addToSelection( lnk ); 823 d->selectedFiles->addToSelection( lnk );
820 writeCurrentM3u(); 824 writeCurrentM3u();
821 d->selectedFiles->setSelectedItem( lnk.name()); 825 d->selectedFiles->setSelectedItem( lnk.name());
822 } 826 }
823 else if( filename.right( 3) == "m3u" ) { 827 else if( filename.right( 3) == "m3u" ) {
824 readm3u( filename ); 828 readm3u( filename );
825 829
826 } else if( filename.right(3) == "pls" ) { 830 } else if( filename.right(3) == "pls" ) {
827 readPls( filename ); 831 readPls( filename );
828 } else { 832 } else {
829 lnk.setName( QFileInfo(filename).baseName() ); //sets name 833 lnk.setName( QFileInfo(filename).baseName() ); //sets name
830 lnk.setFile( filename ); //sets file name 834 lnk.setFile( filename ); //sets file name
831 d->selectedFiles->addToSelection( lnk); 835 d->selectedFiles->addToSelection( lnk);
832 writeCurrentM3u(); 836 writeCurrentM3u();
833 d->selectedFiles->setSelectedItem( lnk.name()); 837 d->selectedFiles->setSelectedItem( lnk.name());
834 } 838 }
835 } 839 }
836 840
837 if( fileDlg ) { 841 if( fileDlg ) {
838 delete fileDlg; 842 delete fileDlg;
839 } 843 }
840} 844}
841 845
842/* 846/*
843reads m3u and shows files/urls to playlist widget */ 847reads m3u and shows files/urls to playlist widget */
844void PlayListWidget::readm3u( const QString &filename ) { 848void PlayListWidget::readm3u( const QString &filename ) {
845 qDebug( "read m3u filename " + filename ); 849 qDebug( "read m3u filename " + filename );
846 850
847 Om3u *m3uList; 851 Om3u *m3uList;
848 QString s, name; 852 QString s, name;
849 m3uList = new Om3u( filename, IO_ReadOnly ); 853 m3uList = new Om3u( filename, IO_ReadOnly );
850 m3uList->readM3u(); 854 m3uList->readM3u();
851 DocLnk lnk; 855 DocLnk lnk;
852 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 856 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
853 s = *it; 857 s = *it;
854// qDebug("reading "+ s); 858// qDebug("reading "+ s);
855 if(s.left(4)=="http") { 859 if(s.left(4)=="http") {
856 lnk.setName( s ); //sets file name 860 lnk.setName( s ); //sets file name
857 lnk.setIcon("opieplayer2/musicfile"); 861 lnk.setIcon("opieplayer2/musicfile");
858 lnk.setFile( s ); //sets file name 862 lnk.setFile( s ); //sets file name
859 863
860 } else { 864 } else {
861 // if( QFileInfo( s ).exists() ) { 865 // if( QFileInfo( s ).exists() ) {
862 lnk.setName( QFileInfo(s).baseName()); 866 lnk.setName( QFileInfo(s).baseName());
863 // if(s.right(4) == '.') {//if regular file 867 // if(s.right(4) == '.') {//if regular file
864 if(s.left(1) != "/") { 868 if(s.left(1) != "/") {
865 // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); 869 // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s);
866 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); 870 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s);
867// lnk.setIcon(MimeType(s).pixmap() ); 871// lnk.setIcon(MimeType(s).pixmap() );
868// lnk.setIcon("SoundPlayer"); 872// lnk.setIcon("SoundPlayer");
869 } else { 873 } else {
870 // qDebug("set link2 "+s); 874 // qDebug("set link2 "+s);
871 lnk.setFile( s); 875 lnk.setFile( s);
872// lnk.setIcon(MimeType(s).pixmap() ); 876// lnk.setIcon(MimeType(s).pixmap() );
873// lnk.setIcon("SoundPlayer"); 877// lnk.setIcon("SoundPlayer");
874 } 878 }
875 } 879 }
876 d->selectedFiles->addToSelection( lnk ); 880 d->selectedFiles->addToSelection( lnk );
877 } 881 }
878 Config config( "OpiePlayer" ); 882 Config config( "OpiePlayer" );
879 config.setGroup( "PlayList" ); 883 config.setGroup( "PlayList" );
880 884
881 config.writeEntry("CurrentPlaylist",filename); 885 config.writeEntry("CurrentPlaylist",filename);
882 config.write(); 886 config.write();
883 currentPlayList=filename; 887 currentPlayList=filename;
884 888
885// m3uList->write(); 889// m3uList->write();
886 m3uList->close(); 890 m3uList->close();
887 if(m3uList) delete m3uList; 891 if(m3uList) delete m3uList;
888 892
889 d->selectedFiles->setSelectedItem( s); 893 d->selectedFiles->setSelectedItem( s);
890 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); 894 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName());
891 895
892} 896}
893 897
894/* 898/*
895reads pls and adds files/urls to playlist */ 899reads pls and adds files/urls to playlist */
896void PlayListWidget::readPls( const QString &filename ) { 900void PlayListWidget::readPls( const QString &filename ) {
897 901
898 qDebug( "pls filename is " + filename ); 902 qDebug( "pls filename is " + filename );
899 Om3u *m3uList; 903 Om3u *m3uList;
900 QString s, name; 904 QString s, name;
901 m3uList = new Om3u( filename, IO_ReadOnly ); 905 m3uList = new Om3u( filename, IO_ReadOnly );
902 m3uList->readPls(); 906 m3uList->readPls();
903 907
904 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 908 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
905 s = *it; 909 s = *it;
906 // s.replace( QRegExp( "%20" )," " ); 910 // s.replace( QRegExp( "%20" )," " );
907 DocLnk lnk( s ); 911 DocLnk lnk( s );
908 QFileInfo f( s ); 912 QFileInfo f( s );
909 QString name = f.baseName(); 913 QString name = f.baseName();
910 914
911 if( name.left( 4 ) == "http" ) { 915 if( name.left( 4 ) == "http" ) {
912 name = s.right( s.length() - 7); 916 name = s.right( s.length() - 7);
913 } else { 917 } else {
914 name = s; 918 name = s;
915 } 919 }
916 920
917 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); 921 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
918 922
919 lnk.setName( name ); 923 lnk.setName( name );
920 if( s.at( s.length() - 4) == '.') {// if this is probably a file 924 if( s.at( s.length() - 4) == '.') {// if this is probably a file
921 lnk.setFile( s ); 925 lnk.setFile( s );
922 } else { //if its a url 926 } else { //if its a url
923// if( name.right( 1 ).find( '/' ) == -1) { 927// if( name.right( 1 ).find( '/' ) == -1) {
924// s += "/"; 928// s += "/";
925// } 929// }
926 lnk.setFile( s ); 930 lnk.setFile( s );
927 } 931 }
928 lnk.setType( "audio/x-mpegurl" ); 932 lnk.setType( "audio/x-mpegurl" );
929 933
930 lnk.writeLink(); 934 lnk.writeLink();
931 d->selectedFiles->addToSelection( lnk ); 935 d->selectedFiles->addToSelection( lnk );
932 } 936 }
933 937
934 m3uList->close(); 938 m3uList->close();
935 if(m3uList) delete m3uList; 939 if(m3uList) delete m3uList;
936} 940}
937 941
938/* 942/*
939 writes current playlist to current m3u file */ 943 writes current playlist to current m3u file */
940void PlayListWidget::writeCurrentM3u() { 944void PlayListWidget::writeCurrentM3u() {
941 qDebug("writing to current m3u"); 945 qDebug("writing to current m3u");
942 Config cfg( "OpiePlayer" ); 946 Config cfg( "OpiePlayer" );
943 cfg.setGroup("PlayList"); 947 cfg.setGroup("PlayList");
944 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 948 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
945 949
946 Om3u *m3uList; 950 Om3u *m3uList;
947 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); 951 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate );
948 if( d->selectedFiles->first()) { 952 if( d->selectedFiles->first()) {
949 953
950 do { 954 do {
951 // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); 955 // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file());
952 m3uList->add( d->selectedFiles->current()->file() ); 956 m3uList->add( d->selectedFiles->current()->file() );
953 } 957 }
954 while ( d->selectedFiles->next() ); 958 while ( d->selectedFiles->next() );
955 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); 959 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" );
956 m3uList->write(); 960 m3uList->write();
957 m3uList->close(); 961 m3uList->close();
958 962
959 if(m3uList) delete m3uList; 963 if(m3uList) delete m3uList;
960 } 964 }
961 965
962} 966}
963 967
964 /* 968 /*
965 writes current playlist to m3u file */ 969 writes current playlist to m3u file */
966void PlayListWidget::writem3u() { 970void PlayListWidget::writem3u() {
967 InputDialog *fileDlg; 971 InputDialog *fileDlg;
968 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); 972 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
969 fileDlg->exec(); 973 fileDlg->exec();
970 QString name, filename, list; 974 QString name, filename, list;
971 Om3u *m3uList; 975 Om3u *m3uList;
972 976
973 if( fileDlg->result() == 1 ) { 977 if( fileDlg->result() == 1 ) {
974 name = fileDlg->text(); 978 name = fileDlg->text();
975// qDebug( filename ); 979// qDebug( filename );
976 980
977 if( name.left( 1) != "/" ) { 981 if( name.left( 1) != "/" ) {
978 filename = QPEApplication::documentDir() + "/" + name; 982 filename = QPEApplication::documentDir() + "/" + name;
979 } 983 }
980 984
981 if( name.right( 3 ) != "m3u" ) { 985 if( name.right( 3 ) != "m3u" ) {
982 filename = QPEApplication::documentDir() + "/" +name+".m3u"; 986 filename = QPEApplication::documentDir() + "/" +name+".m3u";
983 } 987 }
984 988
985 if( d->selectedFiles->first()) { 989 if( d->selectedFiles->first()) {
986 m3uList = new Om3u(filename, IO_ReadWrite); 990 m3uList = new Om3u(filename, IO_ReadWrite);
987 991
988 do { 992 do {
989 m3uList->add( d->selectedFiles->current()->file()); 993 m3uList->add( d->selectedFiles->current()->file());
990 } 994 }
991 while ( d->selectedFiles->next() ); 995 while ( d->selectedFiles->next() );
992 // qDebug( list ); 996 // qDebug( list );
993 m3uList->write(); 997 m3uList->write();
994 m3uList->close(); 998 m3uList->close();
995 if(m3uList) delete m3uList; 999 if(m3uList) delete m3uList;
996 1000
997 if(fileDlg) delete fileDlg; 1001 if(fileDlg) delete fileDlg;
998 1002
999 DocLnk lnk; 1003 DocLnk lnk;
1000 lnk.setFile( filename); 1004 lnk.setFile( filename);
1001 lnk.setIcon("opieplayer2/playlist2"); 1005 lnk.setIcon("opieplayer2/playlist2");
1002 lnk.setName( name); //sets file name 1006 lnk.setName( name); //sets file name
1003 1007
1004 // qDebug(filename); 1008 // qDebug(filename);
1005 Config config( "OpiePlayer" ); 1009 Config config( "OpiePlayer" );
1006 config.setGroup( "PlayList" ); 1010 config.setGroup( "PlayList" );
1007 1011
1008 config.writeEntry("CurrentPlaylist",filename); 1012 config.writeEntry("CurrentPlaylist",filename);
1009 currentPlayList=filename; 1013 currentPlayList=filename;
1010 1014
1011 if(!lnk.writeLink()) { 1015 if(!lnk.writeLink()) {
1012 qDebug("Writing doclink did not work"); 1016 qDebug("Writing doclink did not work");
1013 } 1017 }
1014 1018
1015 setCaption(tr("OpiePlayer: ") + name); 1019 setCaption(tr("OpiePlayer: ") + name);
1016 } 1020 }
1017 } 1021 }
1018} 1022}
1019 1023
1020void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { 1024void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
1021 switch ( e->key() ) { 1025 switch ( e->key() ) {
1022 ////////////////////////////// Zaurus keys 1026 ////////////////////////////// Zaurus keys
1023 case Key_F9: //activity 1027 case Key_F9: //activity
1024 // if(audioUI->isHidden()) 1028 // if(audioUI->isHidden())
1025 // audioUI->showMaximized(); 1029 // audioUI->showMaximized();
1026 break; 1030 break;
1027 case Key_F10: //contacts 1031 case Key_F10: //contacts
1028 // if( videoUI->isHidden()) 1032 // if( videoUI->isHidden())
1029 // videoUI->showMaximized(); 1033 // videoUI->showMaximized();
1030 break; 1034 break;
1031 case Key_F11: //menu 1035 case Key_F11: //menu
1032 break; 1036 break;
1033 case Key_F12: //home 1037 case Key_F12: //home
1034 // doBlank(); 1038 // doBlank();
1035 break; 1039 break;
1036 case Key_F13: //mail 1040 case Key_F13: //mail
1037 // doUnblank(); 1041 // doUnblank();
1038 break; 1042 break;
1039 case Key_Q: //add to playlist 1043 case Key_Q: //add to playlist
1040 addSelected(); 1044 addSelected();
1041 break; 1045 break;
1042 case Key_R: //remove from playlist 1046 case Key_R: //remove from playlist
1043 removeSelected(); 1047 removeSelected();
1044 break; 1048 break;
1045 // case Key_P: //play 1049 // case Key_P: //play
1046 // qDebug("Play"); 1050 // qDebug("Play");
1047 // playSelected(); 1051 // playSelected();
1048 // break; 1052 // break;
1049 case Key_Space: 1053 case Key_Space:
1050 // playSelected(); puh 1054 // playSelected(); puh
1051 break; 1055 break;
1052 case Key_1: 1056 case Key_1:
1053 tabWidget->setCurrentPage( 0 ); 1057 tabWidget->setCurrentPage( 0 );
1054 break; 1058 break;
1055 case Key_2: 1059 case Key_2:
1056 tabWidget->setCurrentPage( 1 ); 1060 tabWidget->setCurrentPage( 1 );
1057 break; 1061 break;
1058 case Key_3: 1062 case Key_3:
1059 tabWidget->setCurrentPage( 2 ); 1063 tabWidget->setCurrentPage( 2 );
1060 break; 1064 break;
1061 case Key_4: 1065 case Key_4:
1062 tabWidget->setCurrentPage( 3 ); 1066 tabWidget->setCurrentPage( 3 );
1063 break; 1067 break;
1064 case Key_Down: 1068 case Key_Down:
1065 if ( !d->selectedFiles->next() ) 1069 if ( !d->selectedFiles->next() )
1066 d->selectedFiles->first(); 1070 d->selectedFiles->first();
1067 break; 1071 break;
1068 case Key_Up: 1072 case Key_Up:
1069 if ( !d->selectedFiles->prev() ) 1073 if ( !d->selectedFiles->prev() )
1070 // d->selectedFiles->last(); 1074 // d->selectedFiles->last();
1071 break; 1075 break;
1072 } 1076 }
1073} 1077}
1074 1078
1075void PlayListWidget::pmViewActivated(int index) { 1079void PlayListWidget::pmViewActivated(int index) {
1076// qDebug("%d", index); 1080// qDebug("%d", index);
1077 switch(index) { 1081 switch(index) {
1078 case -16: 1082 case -16:
1079 { 1083 {
1080 mediaPlayerState->toggleFullscreen(); 1084 mediaPlayerState->toggleFullscreen();
1081 bool b=mediaPlayerState->isFullscreen(); 1085 bool b=mediaPlayerState->isFullscreen();
1082 pmView->setItemChecked( index, b); 1086 pmView->setItemChecked( index, b);
1083 Config cfg( "OpiePlayer" ); 1087 Config cfg( "OpiePlayer" );
1084 cfg.writeEntry( "FullScreen", b ); 1088 cfg.writeEntry( "FullScreen", b );
1085 } 1089 }
1086 break; 1090 break;
1087 }; 1091 };
1088} 1092}
1089 1093
1090void PlayListWidget::populateSkinsMenu() { 1094void PlayListWidget::populateSkinsMenu() {
1091 int item = 0; 1095 int item = 0;
1092 defaultSkinIndex = 0; 1096 defaultSkinIndex = 0;
1093 QString skinName; 1097 QString skinName;
1094 Config cfg( "OpiePlayer" ); 1098 Config cfg( "OpiePlayer" );
1095 cfg.setGroup("Options" ); 1099 cfg.setGroup("Options" );
1096 QString skin = cfg.readEntry( "Skin", "default" ); 1100 QString skin = cfg.readEntry( "Skin", "default" );
1097 1101
1098 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); 1102 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
1099 skinsDir.setFilter( QDir::Dirs ); 1103 skinsDir.setFilter( QDir::Dirs );
1100 skinsDir.setSorting(QDir::Name ); 1104 skinsDir.setSorting(QDir::Name );
1101 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 1105 const QFileInfoList *skinslist = skinsDir.entryInfoList();
1102 QFileInfoListIterator it( *skinslist ); 1106 QFileInfoListIterator it( *skinslist );
1103 QFileInfo *fi; 1107 QFileInfo *fi;
1104 while ( ( fi = it.current() ) ) { 1108 while ( ( fi = it.current() ) ) {
1105 skinName = fi->fileName(); 1109 skinName = fi->fileName();
1106// qDebug( fi->fileName() ); 1110// qDebug( fi->fileName() );
1107 if( skinName != "." && skinName != ".." && skinName !="CVS" ) { 1111 if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
1108 item = skinsMenu->insertItem( fi->fileName() ) ; 1112 item = skinsMenu->insertItem( fi->fileName() ) ;
1109 } 1113 }
1110 if( skinName == "default" ) { 1114 if( skinName == "default" ) {
1111 defaultSkinIndex = item; 1115 defaultSkinIndex = item;
1112 } 1116 }
1113 if( skinName == skin ) { 1117 if( skinName == skin ) {
1114 skinsMenu->setItemChecked( item, TRUE ); 1118 skinsMenu->setItemChecked( item, TRUE );
1115 } 1119 }
1116 ++it; 1120 ++it;
1117 } 1121 }
1118} 1122}
1119 1123
1120void PlayListWidget::skinsMenuActivated( int item ) { 1124void PlayListWidget::skinsMenuActivated( int item ) {
1121 for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { 1125 for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) {
1122 skinsMenu->setItemChecked( i, FALSE ); 1126 skinsMenu->setItemChecked( i, FALSE );
1123 } 1127 }
1124 skinsMenu->setItemChecked( item, TRUE ); 1128 skinsMenu->setItemChecked( item, TRUE );
1125 1129
1126 Config cfg( "OpiePlayer" ); 1130 Config cfg( "OpiePlayer" );
1127 cfg.setGroup("Options"); 1131 cfg.setGroup("Options");
1128 cfg.writeEntry("Skin", skinsMenu->text( item ) ); 1132 cfg.writeEntry("Skin", skinsMenu->text( item ) );
1129 QMessageBox::warning( this, tr( "OpiePlayer" ), 1133 QMessageBox::warning( this, tr( "OpiePlayer" ),
1130 tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) ); 1134 tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) );
1131} 1135}
1132 1136
1133PlayListWidget::TabType PlayListWidget::currentTab() const 1137PlayListWidget::TabType PlayListWidget::currentTab() const
1134{ 1138{
1135 static const TabType indexToTabType[ TabTypeCount ] = 1139 static const TabType indexToTabType[ TabTypeCount ] =
1136 { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; 1140 { CurrentPlayList, AudioFiles, VideoFiles, PlayLists };
1137 1141
1138 int index = tabWidget->currentPageIndex(); 1142 int index = tabWidget->currentPageIndex();
1139 assert( index < TabTypeCount && index >= 0 ); 1143 assert( index < TabTypeCount && index >= 0 );
1140 1144
1141 return indexToTabType[ index ]; 1145 return indexToTabType[ index ];
1142} 1146}
1143 1147
1144PlayListWidget::Entry PlayListWidget::currentEntry() const 1148PlayListWidget::Entry PlayListWidget::currentEntry() const
1145{ 1149{
1146 if ( currentTab() == CurrentPlayList ) { 1150 if ( currentTab() == CurrentPlayList ) {
1147 const DocLnk *lnk = current(); 1151 const DocLnk *lnk = current();
1148 return Entry( lnk->name(), lnk->file() ); 1152 return Entry( lnk->name(), lnk->file() );